Cleaning up Lost Wrappers
 
 
 

If you forget to delete a wrapper or lose a pointer to one, you can use AlDebug::cleanUpUniverse(). This method deletes all invalid wrapper objects in the current universe. Wrapper operations (most notably the deleteObject() operations) will slow down with the more wrappers you use. If calls to the API deleteObject() method start to slow down the longer it runs, it is likely that wrappers are being lost (resulting in a memory leak) and the code should be corrected. As a temporary kludge, the AlDebug::cleanupUniverse() method can be called.

You should avoid AlDebug::cleanUpUniverse() if at all possible. It can cause core dumps if used when other plug-ins are running or with wrappers that are not dynamically allocated. (See the AlDebug::cleanUpUniverse() documentation for a discussion of why.) Furthermore, this function deletes all the wrappers in the universe, regardless of the plug-in that created them. This can cause another plug-in to lose a reference to data and crash.

In short, this function is intended for debugging until you have eliminated all of your memory leaks.