Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Delphi memory management function that allocates memory on the stack?

Tags:

delphi

C world has alloca() or _alloca() that allocates memory on the stack instead of the heap.

Does Delphi has such a function?

like image 506
Astaroth Avatar asked Sep 16 '25 10:09

Astaroth


1 Answers

If you really want to replicate the alloca functionality in Delphi I suggest you look at the StackAlloc function in the Grids unit in the VCL. This is a procedure declared in the implementation section of the unit, so you'd have to copy the VCL source to make use of it.

like image 159
David Heffernan Avatar answered Sep 19 '25 08:09

David Heffernan