I recently was looking at some code that uses SetLength to allocate memory for an array of bytes, but I didn't see any logic to release that memory space. I have read that for an array of bytes you should either set the value to nil or use Finalize?

What is the best way to handle this... Based on what I found it suggests something like the following...

var
  x: array of byte;
begin
  SetLength(x, 30);
  // Do something here
  :
  // Release the array
  x := nil;
  Finalize(x);
end;
Edit
Report