I am using the Clipboard in an application and have created a Pchar called Buffer by using GetMem as follows: GetMem(Buffer,BufferSize) where BufferSize=65536 The GetMem statement is in the Initialization section of the unit. To free the memory occupied by Buffer I placed a FreeMem statement in the finalization section of the unit: FreeMem(Buffer) However under Delphi3 this produces a runtime error 216 when the program closes. I then moved it to FormClose however this produced an invalid pointer operation exception. What is wrong with this statement? Buffer is valid and is used in Clipboard GetTextBuf and SetTextBuf statements which work properlt in the program. On the other hand I have no intention of leaking 64K of memory. ---------------------------------------------------------------------------- ---------- Vote Future New Zealand - for the FUTURE of NEW ZEALAND. Temporary site: http://www.geocities.com/CapitolHill/Senate/9789/fnz/ ================================================= Patrick Dunford, ChristChurch, NZ http://www.geocities.com/Heartland/Village/3405/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz