[fpc-devel] Customer Done procedure for dynamic arrays

Andrew Brunner andrew.t.brunner at gmail.com
Fri May 28 17:47:45 CEST 2010


I use dynamic arrays for data structures and sometimes types.

Under linux I have had no problems with transversing the list of data
and calling "Done" on all types then calling finalize on the list
itself.

Under windows I just executed the same code that worked under linux
but crashed under windows.

TInt64Array=Array of Int64;

procedure Done(var List:TInt64Array);
begin
  Finalize(List);
end;

procedure Empty(var List:TInt64Array);
begin
  SetLength(List,0);
end;

In the above case the two procedures worked under linux.  Under
Windows Done crashes.  Is this a bug that needs to be reported or is
the memory manager performing different under Linux than under
Windows.

This is a basic example.  Some of my data structures involve strings
and sub-arrays to other data structures or pointers thereto.  To fix
the problem I just use Empty instead of Done but I am looking to find
out why can use Finalize on Linux but not on Windows?



More information about the fpc-devel mailing list