mallinfo question
Posted: Mon Sep 20, 2010 2:22 pm
Hi everyone.
This code returns me a strange value.
Can you explain me why the malloc reserved that amount of memory (and why it isn't freed at the end)?
This code returns me a strange value.
Code: Select all
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);
Can you explain me why the malloc reserved that amount of memory (and why it isn't freed at the end)?