Mega Code Archive

 
Categories / Delphi / OOP
 

Allocating a large buffer [new]

// Using large buffers without using GetMem() var s0 : string; s : PChar; p : Pointer; begin // Allocate 1 MB, it will be automaticly dealocated by Delphi when // terminating the application or leaving a function or procedure. SetLength(s0, 1048576); s:=PChar(s0); p:=Pointer(PChar(s0)); end.