[EMAIL PROTECTED] wrote:
What makes you think you have a memory leak?- Hide quoted text -

- Show quoted text -
 > when i run  ksysguard. it shows that my memory is not de-allocated,
and around 40mb of memory
is still being allocated to my program (after reaching printf("ok")).
whereas, In the first case, after the end of delete's , only 4 mb of
memory
is allocated to my program.


So, that simply means the memory is allocated to the process. In other words, to satisfy all 10000 of those extra new's, it had to get a pile of memory from the OS. The delete's return it to the free store (it's *NOT* leaked), but the process does not return it to the OS. It's not required to, nor should it, since the allocator doesn't know if you're going to allocate more memory or not.

So the memory is freed (deleted), but just not returned to the OS -- it's still allocated to your process' memory space.

This is why using tools like top or ksysguard to detect leaks is fairly useless. Use valgrind instead.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to