5

I would like to dynamically allocate memory from an assembly program that does not link against the standard C library. Since brk(2) and sbrk(2) are unavailable on Mac OS X (10.6.2), what are the alternatives?

(I'm guessing that it involves a Mach call, but there seems to be little documentation around that)

4

2 回答 2

2

可能最简单的做法是查看Darwin 源代码并了解 malloc 在内部是如何工作的。

于 2010-03-16T17:47:44.050 回答
2

貌似malloc调用了mmap,调用了__mmap,貌似只是一个syscall

于 2010-03-16T18:42:46.310 回答