I suggest trying without optimisations and/or using cmem, to see if that 
changes the outcome.

Also, if the array is corrupted prior to the setlength, then iterating the 
array with a trivial
  with... Writeln(Color)
or whatever, should trigger an exception.

That could then be used at various parts of the program to identify the point 
of corruption,
which might seem unrelated to array in question if the heap is getting messed 
up somehow.


Cheers,
Peter

P.S.

I had a strange (possible) heap corruption issue with a large program a year 
ago that broke stringlists.
I never found the cause, and after many minor code changes, the problem just 
dissappeared.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to