Vincent Snijders wrote:
Hi,

Attached patch frees the items of the InitHandlerList. The items are allocated in RegisterInitComponentHandler, but never seem to be freeed.
Heaptrc showed a memleak, when you ran lazarus with the cgi package installed.



Further testing showed that the patch contained a bug. InitHandlerList might not be created at all. Attached patch corrects also this case.


Sorry for the confusion.

Regards,
Vincent.
Index: rtl/objpas/classes/classes.inc
===================================================================
RCS file: /FPC/CVS/fpc/rtl/objpas/classes/classes.inc,v
retrieving revision 1.26
diff -u -r1.26 classes.inc
--- rtl/objpas/classes/classes.inc      13 Apr 2005 16:16:43 -0000      1.26
+++ rtl/objpas/classes/classes.inc      27 Apr 2005 08:02:25 -0000
@@ -1496,6 +1496,9 @@
   ComponentPages.Free;
   {!!!: GlobalNameSpace.Free;
   GlobalNameSpace := nil;}
+  if (InitHandlerList<>Nil) then
+    for i := 0 to InitHandlerList.Count - 1 do
+      TInitHandler(InitHandlerList.Items[I]).Free;
   InitHandlerList.Free;
   InitHandlerList:=Nil;
   FindGlobalComponentList.Free;
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to