Hello, [EMAIL PROTECTED] wrote:
> i tried valgrind in combination with the GLIBCXX_FORCE_NEW option. > valgrind > says i have freed all the the heap blocks, but still the memory > occupied by the program > doesn't reduce after doing the free. > (i have increased the loop count from 10,000 to 100,000) > here is the output: > > [EMAIL PROTECTED] temp]$ GLIBCXX_FORCE_NEW=1 valgrind ./test I have similar output from valgrind, and the other runs are similar to yours. I cannot find anything errorneous in your program. On my system (openSuSE 10.2) memory is returned to the OS. When hanging at the OK with loop count 10000 or 100000 the virtual memory of the process is down to around 2MB as displayed by top. With the loop count increased to 100000 my system starts swapping a little bit (it has 512MB RAM), then it gets immediately responsive again after swapping back a little, when hanging at the OK. So memory must be returned to the OS. Maybe your system has so much RAM that the OS decides to wait with actually taking its memory back, perhaps you have to wait a while, or you have to increase the load towards the limits of your system to see what you expect. The allocation cache of libstc++ has been invented to help, your struct makes it really hard to get help from the cache. It might be better to replace the large buffer in the struct by a pointer, and handle allocations of that buffer separately. Bernd Strieder _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus