Problem Source: http://www.cnblogs.com/del/archive/2008/05/02/1179416.html#1179645
I think the functions of getmem and getmemory are the same, a bit similar to those of format and fmtstr;
The difference lies only in the difference between the parameter location and the return value. Let's look at the source code of the getmemory function. It is actually the getmem called.
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; procedure button1click (Sender: tobject); Procedure button2click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.button1click (Sender: tobject); var P: pinteger; begin getmem (p, sizeof (integer); P ^: = 100; showmessage (inttostr (P ^); {100} freemem (p); end; Procedure tform1.button2click (Sender: tobject); var P: pinteger; begin P: = getmemory (sizeof (integer); P ^: = 100; showmessage (inttostr (P ^); {100} freememory (p); end.