# vtkDebugLeaks detects leaks without pattern

**URL:** https://discourse.vtk.org/t/vtkdebugleaks-detects-leaks-without-pattern/4648
**Category:** Development
**Created:** [November 12, 2020, 6:15pm UTC](https://discourse.vtk.org/t/vtkdebugleaks-detects-leaks-without-pattern/4648 "2020-11-12T18:15:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Keyn](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@Keyn](https://discourse.vtk.org/u/Keyn)
#### Post date: [November 12, 2020, 6:15pm UTC](https://discourse.vtk.org/t/vtkdebugleaks-detects-leaks-without-pattern/4648/1 "2020-11-12T18:15:19Z")

</div>

Hello everyone, I have a rather generic question about vtkDebugLeaks. I build vtk 8.2 successfully with it on and was using it for quite some time now. The only report i ever got form vtkDebugLeaks is the following on exiting Qt programs where vtk is used:

```
vtkDebugLeaks has detected LEAKS!
Class "vtkObjectFactoryCollection" has 1 instance still around.

```

But this only happens sometimes, and not in a pattern which I could notice at all. Often I only get the message that no leaks were detected. Can somebody give me a hint where to look for a potential leak or does it sometimes happen, due to using the New() function for Objects?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 13, 2020, 5:40pm UTC](https://discourse.vtk.org/t/vtkdebugleaks-detects-leaks-without-pattern/4648/2 "2020-11-13T17:40:11Z")

</div>

Try this:

> [@New feature: getting a stack trace on leaked objects with VTK\_DEBUG\_LEAKS](https://discourse.vtk.org/t/new-feature-getting-a-stack-trace-on-leaked-objects-with-vtk-debug-leaks/835):
>
> I just merged a [new feature](https://gitlab.kitware.com/vtk/vtk/merge_requests/5448) to VTK that augments vtkDebugLeaks. This feature lets you record a stack trace where leaked VTK objects were allocated. This can be a very useful when debugging VTK object leaks. Previously, if you configured VTK with VTK\_DEBUG\_LEAKS set to ON, VTK would report the types of VTK objects that were never deleted and how many there were when the application exited. This was a useful feature to let you know there was a leak, but it didn’t provide much insight into where t…

---

<div class="post-metadata">

### Author: ![Keyn](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@Keyn](https://discourse.vtk.org/u/Keyn)
#### Post date: [November 13, 2020, 6:55pm UTC](https://discourse.vtk.org/t/vtkdebugleaks-detects-leaks-without-pattern/4648/3 "2020-11-13T18:55:48Z")

</div>

Thank you!  
I already tried this, but nothing else gets reported except the part i posted above. I set the environmental variable as mentioned in the post. I am working on Windows 10.  
For example, today, only one time a leak appeared, again form vtkObjectFactoryCollection.

Maybe any other suggestions?  
Thanks again!
