堆在身体上是什么?

发布于 2025-01-24 17:54:38 字数 210 浏览 1 评论 0原文

我熟悉堆的摘要堆的概念以及如何用malloc等语言实现。但是,我不明白编译器如何在程序员称为“堆”中分配内存。

在ARM-64机器(这是我使用的)中,没有物理堆栈和堆,只有RAM加上CPU中的15个寄存器。计算机将如何在堆上分配指针,例如为动态尺寸的数组分配?它如何确定要保留的内存地址?如果我要在A64汇编中编写内存管理器,那将大致说明什么?

I am familiar with the abstract concept of the heap and how to implement in languages like C with malloc. But, I don't understand how the compiler allocates memory in what programmers call the "heap."

In ARM-64 machines (which is what I'm using), there is no physical stack and heap, just RAM plus 15 registers in the CPU. How would a computer allocate a pointer on the heap, say for a dynamically-sized array? How does it decide which memory address to reserve? If I were to write a memory manager in A64 assembly, what roughly would that entail?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文