Recently I had to find a few leaks in an application and wrote me some leak finder. Here is how it works:
- We walk over all objects via Runtime module and put them in an array. Thereby we skip data objects and introspection objects to reduce the number of objects.
- We check all those objects we get to find references to other objects. This includes looking on keys and values for a dictionary, controls in a window, row tags in a listbox, fields of a RecordSet and other container classes. For arrays of objects, we look into the values.
- By using Introspection we look on the properties in classes to add references.
- For each object found, we look via references if there is a circle way through it. If we find a circle, we report it via FoundLeak event.
This seems to work fine and we found a few leaks ourselves.
We will provide this example project with next plugin version for you to try. Already in 21.1pr2 download by now. Please do not hesitate to contact us with questions.
If you have an improvement suggestion, please report back your changes.