RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2256: Dispose not supported (nor necessary) for dynamic arrays (Delphi)

The compiler has encountered a use of the standard procedure DISPOSE on a dynamic array. Dynamic arrays are reference counted and will automatically free themselves when there are no longer any references to them.

program Produce;
  var
    arr : array of integer;

begin
  SetLength(arr, 10);
  Dispose(arr);
end.
    The use of DISPOSE on the dynamic array arr causes the error in this example.
    
program Produce;
  var
    arr : array of integer;

begin
  SetLength(arr, 10);
end.

The only solution here is to remove the offending use of DISPOSE

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!