TPersistent.com – Using refcounted interfaces can be difficult, especially when introducing them into legacy code. Unfortunately, interfacing is key to breaking dependencies and making code more testable. There are only two approaches I have seen to debugging refcount issues: 1) Create a descendant of TInterfacedObject and override the _AddRef/_Release to log class information and the current refcount. You could also use copy/paste inheritance (although I do not recommend making a habit of it), and change the implementations. 2) Create your own Interface like I did that exposes the RefCount and ClassName ...
Visits by Source
Users who voted for this posting