5
I use a feature on my system where some users may have access to scripts in Pascal Object
and can customize some rules.
This is generating a certain problem of Memory Leak, because just as a developer can forget to destroy an object the user can do the same in this feature, so I’m needing to create a control of Memory Leak very simple and light, where the user will know that created an object but did not destroy it.
The problem I’m facing is intercepting the TComponent
in the constructor and destructor to monitor the created and destroyed objects.
I tried my hardest:
TComponent = class helper for System.Classes.TComponent
protected
constructor Create;
destructor Destroy; // Aqui ocorre um erro ao compilar;
end;
or
TComponent = class(System.Classes.TComponent)
protected
constructor Create; override;
destructor Destroy; override;
end;
In this case it does not always pass, because I have to put in use of all Units.
Does anyone have any solution or hint?
Thank you in advance.
The ideal would be to create a base class of the Generic type with Interface implementation. This way Delphi itself would take care of the demand. In Delphi ARC controls the Leak memory alone, but only for Interface.
– Junior Moreira
Thank you so much for the tip. I will do some research and if successful, I will post here. But if anyone else wishes to speak, I will be grateful.
– Rodrigo