This project has moved and is read-only. For the latest updates, please go here.

How can I control the time interval for leak detection?

Oct 17, 2012 at 3:19 PM

I see that the default behavior for VLD is to track allocations since app start and on app exit report what hasn't been freed.

In my case a certain command "leaks" by allocating and not freeing memory, but the memory does get freed before the app exits.

So, I need to control the interval.  I need to set a starting point and then, while my app is still running, get a report of all "leaks" since that start point, i.e. anything allocated which has not been freed.

Can I do this with VLD?

Oct 17, 2012 at 6:07 PM
Edited Oct 17, 2012 at 6:08 PM

You can control this using VLD API

Oct 17, 2012 at 6:17 PM

I saw those, but it wasn't clear to me how to use them to get what I'm after.

One possibility:

- to start, call VLDDisable() then immediately VLDEnable()
- run the commands which leak
- call VLDDisable()

Now, how do I get a report of what has been allocated between the enable and disable?   I tried calling VLDReportLeaks() after disabling it, but this reported nothing even for cases where I know I've allocated memory and not yet freed it.

So while I did see those APIs earlier, it wasn't clear to me based on looking through them and some testing how to achieve my goal.

Any idea what I might be missing in the above?

Oct 18, 2012 at 11:31 PM
Edited Oct 18, 2012 at 11:32 PM

This API work per-thread. Make sure you call in correct thread. VLDReportLeaks() should work in this situation.