How to dynamically allocate memory in assembly language on Linux

Опубликовано: 22 Октябрь 2024
на канале: Computing Mongoose
226
15

I explain how to allocate memory dynamically using the MMAP SYSCALL on Linux in x86 64-bit assembly language. I present two functions: the first allocates a memory block of a specified size, and the second frees a memory block allocated by a previous call. Finally, I adapt the example from the previous video (that uses a statically allocated Trie structure) to use dynamic memory allocation.

Previous related videos:
How to implement a Trie in assembly language:
   • How to implement a Trie in assembly l...  

Read from a file using memory mapping in assembly language:
   • Reading a file using Memory Mapping i...  

Writing to the Linux console using SYSCALL:
   • Writing to Linux console in 64bit ass...  

Convert an integer number to a string and display:
   • Convert 32bit decimal numbers to stri...  

Manual page of the mmap function:
https://man7.org/linux/man-pages/man2...

Interfacing with the kernel:
https://en.wikibooks.org/wiki/X86_Ass...

#assemblylanguage #linux #64bits #x86