This library automatically removes the most part of memory leaks, including locs, rects, effects, groups and forces. Works even in GUI-triggers.
All what You need to use this is to copy the source code to Your map.
If You do not need to destroy some object, You can disable the system...