Assembly Programming Assembly Memory Management - Assembly Programming

What is Assembly Memory Management?

The sys_brk() system call is provided by the kernel, to allocate memory without the need of moving it later. This call allocates memory right behind the application image in the memory. This system function allows you to set the highest available address in the data section.

This system call takes one parameter, which is the highest memory address needed to be set. This value is stored in the EBX register.

In case of any error, sys_brk() returns -1 or returns the negative error code itself. the following example demonstrates dynamic memory allocation.

Example

The following program allocates 16kb of memory the usage of the sys_brk() system call –

When the above code is compiled and executed, it produces the following result –

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Assembly Programming Topics