Problem Memory leak in Open cascade sample

Dear Sir!

I find the open cascade memory problem.

by using bound check program, i tested the sample code "samplegeometry.exe".

The bounder checker tell me the follwing.

1. many memory leak 2. many resource leak.

I would like to solve the memory leak.

Thanks

Mikael Aronsson's picture

Hi !

This does not mean that there is a memory leak, it just indicates that you do not release all memory when the application is terminated, this is normally not a problem (even though Windows9x can be picky about resources some times).

If it is a memory leak then you need to find where the memory leak is, run the debug version (also use debug version of OpenCascade libraries), then you will find out what it is that is considered to be a leak.

OpenCascade use reference counting for most memory, this is not perfect in any way but works good most of the time.

Just remember that any allocated memory that is not released BEFORE the application terminates and then you will get a memory leak error, this mean that if you for example call malloc in your InitInstance() member function and forget to release that memory in your ExitInstance() member function you will get a memory leak, it is harmless and isn't even a memory leak as Windows will release the memory any way when the application exits.

Without more info about the memory leak (debug info) it's difficult to say if it is a problem.

One way to find out is to run the example for some time and doing different tings many times over and over and see if you get more messages about memory leaks then, this might be an indication that it is a true memory leak.

Mikael