[Solved]Memory leak, again... September 20, 2010 03:16PM | Registered: 15 years ago Posts: 161 |
VPAD_Init(); struct mallinfo nfo = mallinfo(); struct mallinfo nfo2; u32 length = 23801856; cout << endl << endl << endl << "Memory used: " << nfo.uordblks << endl; void* ptr = malloc(length); nfo2 = mallinfo(); cout << "Allocated: " << nfo2.uordblks << endl; cout << "Diff: " << nfo2.uordblks - nfo.uordblks << endl; free(ptr); nfo = mallinfo(); cout << "Memory used: " << nfo.uordblks << endl; while(VPAD_ButtonsDown(0) == 0);
Re: Memory leak, again... September 20, 2010 05:39PM | Registered: 15 years ago Posts: 379 |
Re: Memory leak, again... September 20, 2010 05:43PM | Registered: 15 years ago Posts: 161 |
Re: Memory leak, again... September 20, 2010 08:37PM | Registered: 15 years ago Posts: 379 |
Re: Memory leak, again... September 21, 2010 11:02AM | Registered: 15 years ago Posts: 161 |
Re: Memory leak, again... September 21, 2010 11:58AM | Registered: 15 years ago Posts: 234 |
struct mallinfo before; struct mallinfo during; struct mallinfo after; u32 length = 0x2000; int poo = 10; void* ptr; struct mallinfo now = mallinfo(); gprintf("n: %d\n\n", now.uordblks ); while( poo-- ) { before = mallinfo(); ptr = malloc( length ); during = mallinfo(); free(ptr); after = mallinfo(); gprintf("b: %d\nd: %d\na: %d\n\n", before.uordblks, during.uordblks, after.uordblks ); }
n: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192 b: 2192 d: 10392 a: 2192
Re: Memory leak, again... September 21, 2010 12:08PM | Registered: 15 years ago Posts: 161 |
Re: Memory leak, again... September 21, 2010 02:23PM | Registered: 15 years ago Posts: 686 |
Re: Memory leak, again... September 21, 2010 02:29PM | Registered: 15 years ago Posts: 161 |