[fpc-devel]memory leak in fpc v1.1
Sergey Korshunoff
seyko at comail.ru
Sat Jun 15 20:40:22 CEST 2002
Hi!
Memory leak is very small but if You prefere to be clean....
1)
Do not call an initwriting if MaybeNextList(hp)=false
This patch remove a memory leak in smartlinking mode for:
i386/cpu.pp, unix/errors.pp etc.
diff -urN FPC-MY-1.old/fpc/compiler/assemble.pas
FPC-MY-1/fpc/compiler/assemble.pas
--- FPC-MY-1.old/fpc/compiler/assemble.pas Sat Jun 15 02:13:23 2002
+++ FPC-MY-1/fpc/compiler/assemble.pas Sat Jun 15 02:22:39 2002
@@ -1484,8 +1484,6 @@
end;
NextSmartName(place);
- objectoutput.initwriting(ObjFile);
- objectdata:=objectoutput.data;
{ there is a problem if startsec is sec_none !! PM }
if startsec=sec_none then
@@ -1493,6 +1491,9 @@
if not MaybeNextList(hp) then
break;
+
+ objectoutput.initwriting(ObjFile);
+ objectdata:=objectoutput.data;
end;
end;
2)
Destory object before replacing it with other one
(try to compile util/obj2bin.pp to examine this leak)
diff -urN FPC-MY-1.old/fpc/compiler/symsym.pas
FPC-MY-1/fpc/compiler/symsym.pas
--- FPC-MY-1.old/fpc/compiler/symsym.pas Sat Jun 15 22:00:31 2002
+++ FPC-MY-1/fpc/compiler/symsym.pas Sat Jun 15 22:06:49 2002
@@ -1070,11 +1070,11 @@
index:=overriden.index;
default:=overriden.default;
indextype:=overriden.indextype;
- readaccess.clear;
+ readaccess.free;
readaccess:=overriden.readaccess.getcopy;
- writeaccess.clear;
+ writeaccess.free;
writeaccess:=overriden.writeaccess.getcopy;
- storedaccess.clear;
+ storedaccess.free;
storedaccess:=overriden.storedaccess.getcopy;
end;
More information about the fpc-devel
mailing list