SmartEvent Memory Leaks

Home Forums kbmMW SmartEvent Memory Leaks

Viewing 4 reply threads
  • Author
    Posts
    • #56915
      chmichael
      Participant

      Hello,

      Seems smart events has the same memory leak as native transport had ?
      I’ve checked the code and the KBMMWFinalize runs on the application shutdown so i guess it’s interface leak.

      • This topic was modified 1 year, 3 months ago by chmichael.
    • #56925
      kimbomadsen
      Keymaster

      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

      • #56926
        chmichael
        Participant

        Hello!

        Yes! Here’s the code:

        procedure TFormMain.FormClose(Sender: TObject; var Action: TCloseAction);
        begin
        CommonServer.doServerTerminate;
        kbmMWShutdown;
        end;

        btw, i’m not using smartevents at all in my app!

        • This reply was modified 1 year, 3 months ago by chmichael.
    • #56928
      chmichael
      Participant

      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!

      • #56930
        kimbomadsen
        Keymaster

        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

         

        • #56931
          chmichael
          Participant

          Can you free this upon finalization or needed to do it manually ?

    • #56937
      kimbomadsen
      Keymaster

      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.

    • #56946
      chmichael
      Participant

      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;

Viewing 4 reply threads
  • You must be logged in to reply to this topic.