Memory Leak using TIDNotify , threadsafe VCL interaction

前提是你 提交于 2019-12-11 20:22:22

问题


the following code is used to allow threadsafe VCL interaction from INDY 10 tcpserver.onexecute();

///  a function to write information into a TBitmap 
TVclNavigationImage= procedure( ll, ur, ll_v , ur_v : TPoint ) of object;

TVCLUpdateNotify = class(TIdNotify)
 protected
 f_ll, f_ur, f_ll_v , f_ur_v  : TPoint;
 FProc: TVclNavigationImage;
 procedure DoNotify; override;
 public
 constructor Create(ll, ur, ll_v , ur_v : TPoint; aProc:TVclNavigationImage); reintroduce;
 class procedure UpdateNavigationWindow(ll, ur, ll_v , ur_v : TPoint ; aProc: TVclNavigationImage);
 end;

 class procedure TVCLUpdateNotify.UpdateNavigationWindow(ll, ur, ll_v , ur_v : TPoint ; aProc: TVclNavigationImage);
 begin
 with Create(ll, ur, ll_v , ur_v, aProc) do
     begin
     Notify;
     end;
end;

in the Onexecute function there is

procedure TForm1.IdTCPServerExecute(AContext: TIdContext);
begin
    ....
    TVCLUpdateNotify.UpdateNavigationWindow(....)
    ....
 end;

According to MADSHI debugger this line of code in the serveronexecute() is creating a memory leak. There is no free function inside my class. How to make that code memory leak free ?


回答1:


Make sure you are using an up-to-date version of Indy 10. In older versions, TIdNotify did have a memory leak, but that was fixed 10 months ago.



来源:https://stackoverflow.com/questions/13502748/memory-leak-using-tidnotify-threadsafe-vcl-interaction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!