Search code examples
memory-managementdelphi-7dynamic-arrays

New on record with dynamic Size


If there is a record like this:

type myType=record 
       a : array of byte;
     end;`
     pMyType=^myType;

Can i get memory for this without calling getMem and without calculate the size by myself?

I like to use New but where do i specify the length of a?


Solution

  • Ok,

    New create the record with a's initial size of 0. The SetLength changes the used memory in Run-Time.