Andrew Brunner wrote:
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?

Why do you want to finalize it ? This is automatically done by fpc when you set the length to 0 (or when the array goes out of scope)

Marc

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to