Memory usage problem
Posted: 2012-09-11T04:47:07-07:00
Hi everyone!
I have folowing code.
i
At first it allocates aprox. 2Gb of memory, when I delete created images memory is not actualy freed, process still use 2Gb of memory. Valgrind shows what that memory still rechable.
How can I free that memory?
Thanks in advice!
I have folowing code.
i
Code: Select all
nt main(int argc, char *argv[])
{
Image* arr[256];
for(int i = 0; i < 256; i++)
{
Image* t = new Image(_pictures_background);
t->read("files/1.png");
arr[i] = t;
}
std::string str;
cout << "Memory allocated. Press enter key to continue...";
cin >> str;
for(int i = 0; i < 256; i++)
{
delete arr[i];
arr[i] = NULL;
}
cout << "Memory deallocated. Press enter key to continue...";
cin >> str;
return 0;
}
How can I free that memory?
Thanks in advice!