[C++] RhinoIntersectBreps, DebugBreak leads to memory leak

I have some code in which I use the RhinoIntersectBreps call to intersect a surface with a planar surface. During debugging in the debug version of Rhino of the SDK, I sometimes get a DebugBreak. Just choosing continue does not give any problems like crashes. But: I do see that there are memory leaks that originate from this point.

The reason for this seems to be that the intersection between the two Breps is not very “nice”, for example intersection through co-planar parts, or an intersection that has edges of both Breps very close to each other.
I say this, because if I take care to avoid these not-so-nice cases, the DebugBreak does not occur and the memory leaks are not reported.

Anyway, first of all I wanted to report this behavior. Secondly, I do not seem to be able to do anything in code to handle the situation and prevent memory leaks. I have tried to catch std::exception and CException but that does not work (no exceptions seem to be thrown). Any suggestions on how to handle this are welcome.

Do you have some geometry that I can test against?

I’ll try to cook something up on Monday. Hopefully I will be able to reproduce this in a simple command with geometry from the document.

I can reproduce the DebugBreak, but not the memory leak.

If you want me to pursue this, I’ll need some geometry and probably some sample code.

I have sent you an e-mail with sample code & file.