Are records reference counted?

Are records reference counted?
Is Delphi using ARC in lifetime management of records?
I can't find documentation about this.

Comments

  1. David Heffernan As you know, they're not "just like" integers and floats though.

    As Marco Cantù said they're managed, in the sense that the compiler will insert extra code to initialize and finalize records if they contain managed types.

    This is an important distinction if one uses records with managed types (strings, dynamic arrays) and allocate them manually on the heap (as it's out of the compilers hands then).

    ReplyDelete
  2. Asbjørn Heid  You can think of that extra code as being associated with the data contained within the record. The record itself is just a value.

    What Marco Cantù was getting at was that their memory is automatically allocated and deallocated. In the same was as any other value type is when declared as a local variable, or a field of a compound type. In that sense managed was a poor choice of terminology. Managed is typically used to refer to types like strings, interfaces, classes under ARC, etc. reference types whose lifetime is managed by reference counting.

    ReplyDelete

Post a Comment