You can create dynamic variables
by calling the GetMem or New procedure. Such variables are
allocated on the heap and are not managed automatically. Once you create one,
it is your responsibility ultimately to free the variable’s memory; use FreeMem
to destroy variables created by GetMem and Dispose to destroy
variables created by New. Other standard routines that operate on
dynamic variables include ReallocMem, Initialize, StrAlloc,
and StrDispose.
Long strings, wide strings, dynamic arrays, variants, and interfaces are also heap-allocated dynamic variables, but their memory is managed automatically.
可以通过调用GetMem或New过程创建动态变量。这样的变量在堆中分配并且不会被自动管理。一旦创建了这样的一个变量,就需要最终释放变量内存。(用GetMem创建的变量,需要用FreeMem来销毁变量;用New创建则需要用Dispose来销毁。)其他作用于动态变量的标准例程包括ReallocMem、Initialize、StrAlloc和StrDispose。
长串,宽串,动态数组,变体,以及接口,也是在堆中分配的动态变量,但这些变量的内存管理是自动的。