Memory leak in OCAF document handling

Hi all,

I have a giant memory leak and don't know how to solve: When I open an OCAF document and close it in the very next step again, I can see with the help of a profiler (AQTime) that not even half of the allocated memory is released. There are no steps in between and I hold no references to any objects of the document. When opening and closing the same document again and again, I run out of memory. I use OCC6.1.
- Can anyone confirm this behaviour?
- If so, can this problem be fixed by upgrading to OCC6.3?
Any other help is very welcome.

Thanks in advance.

Dirk B's picture

I can confirm this behavior using version 6.3. I have written a little about this in the thread . Additionally the unreleased memory is a lot larger when you display shapes from the document. I have no clue how to fix this.


Marco Matt's picture
mz's picture

Thanks for this hint.
The point of this blog entry is to call the application's close method what I already do. The code I use to produce the memory leak looks like this:

Handle_OcafApplication myOwnOcafApplication = new OcafApplication();
TCollection_ExtendedString ocafFile = ""; // here goes the path of some ocafFile

for(int i=0; i<50; i++)
Handle_TDocStd_Document docHandle;
myOwnOcafApplication->Open(geometryFile, docHandle);
// here the scope of docHandle ended and all memory should already be released

I just found out another detail: When using OCAF files with a size of about 100KB, the memory is indead released. But when files are about 10MB, the memory leak will occur.