You are here

Memory leak

1 post / 0 new
Nick Ring
Offline
Last seen: 14 years 8 months ago
Joined: 2009-07-07 16:36
Memory leak

Hi,

I am not sure if this is the right place or not (and I apologise if it isn't) but the PAM has a memory leak (both version 1.5.2 and 1.6 beta).

When PAM reloads the application list, it calls TfrmMenu.ClearButtons, which clears the TAppListItem array. It doesn't actually frees the TAppListItem or TIcon objects. Upon exit, the TAppListItem array (and TIcon) objects are not freed.

There are two issues (with fixes):

1) TfrmMenu.ClearButtons needs to be modified from:

for intCounter:=0 to Length(arrAppItems) - 1 do
arrAppItems[intCounter].Icon:=nil;

to:

for intCounter:=0 to Length(arrAppItems) - 1 do
begin
arrAppItems[intCounter].Icon.Free; // Free the TIcon object
arrAppItems[intCounter].Icon:=nil;
arrAppItems[intCounter].Free; // Free the TAppListItem object
arrAppItems[intCounter]:=nil;
end;

2) TfrmMenu.FormDestroy should call TfrmMenu.ClearButtons to free up the TIcon and TAppListItem objects.

Cheers,
Nick

P.S. I am just trying to improve PAM, not being critical...