C++
How to disable SolidWorks memory handler
A DLL add-in runs in the same address space as SolidWorks. If your DLL dynamically allocates memory, then this memory is in the SolidWorks address space.
SolidWorks installs an exception handler that catches all failures to dynamically allocate memory. In some cases, the add-in can adjust its algorithms for such low memory situations. However, the SolidWorks memory handler is invoked upon any such failures.
To install your own memory handler, you can use the VC++ function:
_set_new_handler()
before attempting to dynamically allocate memory. You should always restore the SolidWorks memory handler after you have finished allocating memory. |