# HOOPS EXCHANGE - disposing memory after traversing annotations and views

**URL:** <https://forum.techsoft3d.com/t/hoops-exchange-disposing-memory-after-traversing-annotations-and-views/5146>\
**Category:** HOOPS Exchange\
**Created:** [May 15, 2026, 4:32pm UTC](https://forum.techsoft3d.com/t/hoops-exchange-disposing-memory-after-traversing-annotations-and-views/5146 "2026-05-15T16:32:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michal.sawczuk](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@michal.sawczuk](https://forum.techsoft3d.com/u/michal.sawczuk)\
**Post date:** [May 15, 2026, 4:32pm UTC](https://forum.techsoft3d.com/t/hoops-exchange-disposing-memory-after-traversing-annotations-and-views/5146/1 "2026-05-15T16:32:57Z")

</div>

Could you help me to release memory after using following parts of code which are identical to sample Viewer’s code of HOOPS Exchange, TreeTraverse.cpp:

A3DUns32 uNbAnnotationEntity = m\_sProductOccurrenceData.m\_uiAnnotationsSize;  
for (uI = 0; uI \< uNbAnnotationEntity; uI++)  
{  
A3DMkpAnnotationEntityConnector sAnnotationEntityConnector(m\_sProductOccurrenceData.m\_ppAnnotations[uI]);  
sAnnotationEntityConnector.TraverseAnnotationEntity(psVisitor);  
}

, and:

for (uI = 0; uI \< uNbView; uI++)  
{  
A3DMkpViewConnector sMkpViewConnector(m\_sProductOccurrenceData.m\_ppViews[uI]);  
sMkpViewConnector.TraverseView(psVisitor);  
}

I think it should be done by availabe distructor:

~A3DProductOccurrenceConnector() { A3DAsmProductOccurrenceGet(NULL, &m\_sProductOccurrenceData); }

but I collect growing memory leaks with each use. Any hints appreciated.

---

<div class="post-metadata">

**Author:** ![mike](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.techsoft3d.com/mike/32/228_2.png) [@mike](https://forum.techsoft3d.com/u/mike)\
**Post date:** [May 22, 2026, 10:22pm UTC](https://forum.techsoft3d.com/t/hoops-exchange-disposing-memory-after-traversing-annotations-and-views/5146/2 "2026-05-22T22:22:21Z")

</div>

@michal.sawczuk thanks for submitting a ticket with this question in our support portal. We’ll post a summary here to help others once your questions are answer.

Mike

---

<div class="post-metadata">

**Author:** ![etienne.luquin](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@etienne.luquin](https://forum.techsoft3d.com/u/etienne.luquin)\
**Post date:** [October 7, 2026, 12:48pm UTC](https://forum.techsoft3d.com/t/hoops-exchange-disposing-memory-after-traversing-annotations-and-views/5146/3 "2026-10-07T12:48:16Z")

</div>

Hello,

We have identified a vector of pointers that is not deallocated in HOOPS Exchange Viewer sample after traversing annotation items.

To fix the memory leaks, add the following code in `traverse\MarkupTraverse.cpp` in the `TraverseAnnotationItem` function at line 105.

> for (auto ptr : asMarkupTessConnector)  
> {  
> delete ptr;  
> }

Etienne
