If you miss 115 instances of this class, then this is the class that leaked. The memory occupied by this class, and not the memory occupied by the things to which it refers, leaks out. Somewhere you have 115 instances of TCwcBasicAdapter that you are not freeing.
In addition, properties do not store data, regardless of whether they are interfaces or some other type. Only the fields take up memory (along with some hidden space that the compiler allocates for the class name).
So yes, you bark the wrong tree. Your memory leak is somewhere else. When FastMM tells you that you have a memory leak, doesnβt it also tell you where each missing instance was allocated. He has that ability; You may need to configure some conditional compilation characters to enable this feature.
Of course, these are not only leaks of this class. FastMM should also report other leaks, such as class instances or classes that implement the interface.
Based on the function you added, I began to suspect that it really is TCwcCDSAdapterNavBase that is TCwcCDSAdapterNavBase , and this may be due to the atypical way you use to create it. Is an exception handler GetAdapterNav in GetAdapterNav ? I doubt it; TObject.GetInterface never explicitly throws an exception. If the object does not support the interface, it returns False . All that an exception handler can catch is things like access violations and illegal operations, which you really shouldn't catch there anyway.
You can implement this function more directly as follows:
if Assigned(FDataSet) then Result := TCwcCDSAdapterNavBase.Create(...);
source share