- This topic has 7 replies, 2 voices, and was last updated 1 year, 3 months ago by .
Viewing 4 reply threads
Viewing 4 reply threads
- You must be logged in to reply to this topic.
Hi,
As far as I can see it is TkbmMWEvents that are leaked?
It is usually a singleton, unless you defined it yourself somewhere in your code?
Have you tried to issue a kbmMWShutdown before closing your application?
/Kim
Oh! i found i had a “kbmMWSmartEvent” declaration in one of my units that caused this. So even if you don’t use the SmartEvent declaring the unit causes this. Removed and the leaks gone!
Yes, adding kbmMWSmartEvent to the uses clause makes a singleton Event variable available, which is used for subscribing for events and notifying others about events happening.
/Kim
It does indeed clean it up at finalization, if the depending units have first been finalized.
It is all governed by the kbmMWDependency unit.
If it does not call the RunFinalization procedure in the kbmMWSmartEvent.pas unit during shutdown, there is something preventing it to do so.
If you can provide a (small) sample not requiring 3rdparty (except kbmMW/MemTable) that do not clean up, then I would be interested in getting that.
It could also be that MadExcept is building its trace a bit to early in the shutdown phase.
Found the issue! The leak occurs when you call kbmmwshutdown before you terminate you application.
procedure TForm25.FormClose(Sender: TObject; var Action: TCloseAction);
begin
kbmmwshutdown; //comment me to prevent leak
end;