Heap Memory Allocation in ARM64 Assembly without the C Standard Library


I’m trying to find a way to do heap memory allocation in armv8-a assembly, and after looking through syscall tables and trying to look at the Linux Programmer’s Manual I can’t find any way to allocate and de-allocate memory at runtime without using malloc and free from the c standard library.

I’ve looked at brk() but that doesn’t appear to have any way to de-allocate memory.


mmap with MAP_ANONYMOUS is preferred to sbrk/brk for most purposes in modern programs. Use munmap to free.

By the way, brk can deallocate memory; simply pass an address lower than the current break point. But this does limit you to freeing in a last-in-first-out fashion.

Answered By – Nate Eldredge

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published