From: David C. <dcc...@ac...> - 2011-11-28 21:07:34
|
On 11/28/2011 12:42 PM, Ehab Ababneh wrote: > Hello, > > I have looked at Memcheck and found out that it detects memory leaks > *after* finishing executing the guest application (i.e.no > <http://i.e.no/> memory leak is detected as soon the last reference to > the allocated memory chunk is out of scope). Is that right or did I > miss something? > > Thanks. > That is correct. Memcheck is not a garbage collection system and does not count memory references dynamically. That would slow down your program even more. There are many ways in which references to memory can be "lost", such as storing a new value in a pointer variable, and without reference counts every one of these ways would trigger a full memory scan. In many applications, most memory is not released when execution exits some scope; instead it is passed from module to module. Thus there would not be much advantage to a scan every time you return from a function, restart a loop iteration, etc. -- David Chapman dcc...@ac... Chapman Consulting -- San Jose, CA |