Question

I have a data structure as follows.

TJustCalGroup = record
    SigName,GroupName:string;
    RawMin,RawMax:LongInt;
end;

I create an instance of the record or data structure as follows.

var ARecord := new TJustCalGroup;

Then, I want to delete the instance or mark it as being unused. So, I am doing the following.

ARecord := Nil;

However, it is not working. It keeps raising an error, "Can not assign nil to TJustCalGroup."

So, then how do you make it nil or null or free up its memory?

Was it helpful?

Solution

A delphi prism (or Oxygene)record is equivalent to a Struct , the structs (or records) are value types and is allocated always on the stack (even when you uses the new operator), so you don't need free the memory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top