Does it take time to deallocate memory?
Posted
by jm1234567890
on Stack Overflow
See other posts from Stack Overflow
or by jm1234567890
Published on 2010-04-03T19:31:25Z
Indexed on
2010/04/03
19:33 UTC
Read the original article
Hit count: 373
I have a C++ program which, during execution, will allocate about 3-8Gb of memory to store a hash table (I use tr1/unordered_map) and various other data structures.
However, at the end of execution, there will be a long pause before returning to shell.
For example, at the very end of my main function I have
std::cout << "End of execution" << endl;
But the execution of my program will go something like
$ ./program
do stuff...
End of execution
[long pause of maybe 2 min]
$ -- returns to shell
Is this expected behavior or am I doing something wrong?
I'm guessing that the program is deallocating the memory at the end. But, commercial applications which use large amounts of memory (such as photoshop) do not exhibit this pause when you close the application.
Please advise :)
© Stack Overflow or respective owner