Show: Object Pascal C++
Display Preferences

E2256 Dispose not supported (nor necessary) for dynamic arrays (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index


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.

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);
  Dispose(arr);
end.
	

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

program Produce;
  var
    arr : array of integer;

begin
  SetLength(arr, 10);
end.
Personal tools
In other languages