El 23/12/2015 a las 18:24, Jonas Maebe escribió: > Santiago Amposta wrote: > > > This is a bug in FPC 2.6.4 (it did not initialise managed fields of > parent objects for child objects that do not declare extra managed > fields). It is fixed in FPC 3.0. >
I have used constructors as a workaround now I have a problem of memory leaks. TSimpleArrayString=object List:array of String; constructor Init; end; { TDerivedArrayString } TDerivedArrayString=object(TSimpleArrayString) other_field:integer; constructor Init; end; constructor TDerivedArrayString.Init; begin // nothing end; constructor TSimpleArrayString.Init; begin // nothing end; procedure TestSimple; var A:TSimpleArrayString; begin a.init; setLength(A.List,16); end; procedure TestDerived; var A:TDerivedArrayString; begin a.init; SetLength(a.list,16); SetLength(a.list,0); // If i comment this line, when I finish the program, the debug says there are unfreed blocks end; In TDerivedArrayString I need to manually set the length of the list to zero. If I don't, the memory is not freed, but in TSimpleArrayString it frees memory. Is it also a known bug of 2.6.4? -- Saludos Santiago A. s...@ciberpiula.net _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal