# Is this a memory leak

**URL:** <https://discourse.vtk.org/t/is-this-a-memory-leak/10997>\
**Category:** Development\
**Tags:** code\
**Created:** [March 17, 2023, 1:59am UTC](https://discourse.vtk.org/t/is-this-a-memory-leak/10997 "2023-03-17T01:59:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)\
**Post date:** [March 17, 2023, 1:59am UTC](https://discourse.vtk.org/t/is-this-a-memory-leak/10997/1 "2023-03-17T01:59:43Z")

</div>

vtkDebugLeaks has detected LEAKS!  
Class “vtkMinimalStandardRandomSequence” has 1 instance still around.  
Class “vtkCellArray” has 1 instance still around.  
Class “vtkBoxMuellerRandomSequence” has 1 instance still around.  
Class “vtkIdList” has 1 instance still around.  
Class “vtkMathInternal” has 1 instance still around.  
Class “vtkIdTypeArray” has 1 instance still around.  
Class “class vtkBuffer\<\_\_int64\>” has 3 instances still around.  
Class “vtkTypeInt64Array” has 2 instances still around.  
Class “vtkRenderingFreeTypeObjectFactory” has 1 instance still around.  
Class “vtkObjectFactoryCollection” has 1 instance still around.  
Class “vtkInteractionStyleObjectFactory” has 1 instance still around.

````auto
int main()
{
	for (size_t i = 0; i < 100; i++)
	{
	//auto cor=vtkSmartPointer<vtkCornerAnnotation>::New();
	}
	vtkDebugLeaks::PrintCurrentLeaks();
}
```code is empty.
````

---

<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:** [March 17, 2023, 6:56am UTC](https://discourse.vtk.org/t/is-this-a-memory-leak/10997/2 "2023-03-17T06:56:26Z")

</div>

Please share a complete example, cmake and includes included.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)\
**Post date:** [March 19, 2023, 12:20am UTC](https://discourse.vtk.org/t/is-this-a-memory-leak/10997/3 "2023-03-19T00:20:06Z")

</div>

There are a number of global objects that this is likely surfacing. I don’t know that `PrintCurrentLeaks` is reliable unless called from the static destructor that normally invokes it.
