There are memory leaks in OpenCascade 5.1.2.

There are some discussions about memory leaks in earlier threads in this forum. It's true that software checking for leaks also detect leaks which are not leaks, but...

We checked for memory leaks with BoundsChecker 7.0. Once we did it with memory optimization and once without (OCC environment variable MMGT_OPT set to 0). As mentioned boundschecker shows many leaks which are not leaks resulting from the own memory management of OpenCascade. But there are memory leaks in the OCC release 5.1.2. I want to present a very clear example. The following code can be found in math_StackMemoryManager. It's the reallocation of the stack. The memory of the old stack will never be freed, because the code line with the delete-statement is set to comment!!! As mentioned, this is sourcecode from the release 5.1.2. In our application, only this leak has shortly a dimension about 3-4 MByte!

static void ReallocateStack(Standard_Integer NewSize) {

// printf("Stack is full : reallocation\n");
if(NewSize Standard_Failure::Raise(); // Exception("ReallocateStack Error");
char *NewStack = new char[NewSize];
if(NewStack == 0) {
Standard_Failure::Raise(); // MemoryOverflow Exception;
memcpy(NewStack, Stack, (int)StackSize);
// delete Stack;
StackSize = NewSize;
Stack = NewStack;

Feel free to check ourself. Boundschecker offers a free evalution Software (14-days or so).

Does someone know how to report such leaks to the OpenCascade developement team?


Forum supervisor's picture

Hello Marcel,

Actually it's indeed a problem which seems to originate from the code appeared yet before the overall OCCT memory management was introduced.
The classes have not been in use and that's why the problem was not detected in the past.
We'll try to provide a correction in coming versions of Open CASCADE Technology, in one of either public or client's maintenance releases.

Best regards,
Forum supervisor