是否有一个Delphi内存管理功能可以在堆栈上分配内存? [英] Is there a Delphi memory management function that allocates memory on the stack?

查看:51
本文介绍了是否有一个Delphi内存管理功能可以在堆栈上分配内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C世界具有 alloca() _alloca()可以在堆栈而不是堆上分配内存.

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

Delphi有这种功能吗?

Does Delphi has such a function?

推荐答案

如果您真的想在Delphi中复制 alloca 功能,建议您查看 StackAlloc 函数在VCL中的网格"单元中.这是在单元的实现"部分中声明的过程,因此您必须复制VCL源才能使用它.

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.

这篇关于是否有一个Delphi内存管理功能可以在堆栈上分配内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆