When an executable is loaded, the user data is stored:
1) statically allocated data region which is never released.
2) User Mode Stack is stored at an end. This memory region grows down so that the VM_END never changes, but VM_START is shifted down when the over flow occurs.
3) Dynamically stored areas called heap. This is the place where all the memory used by the program that is dynamically allocated is stored. This is the area which is reserved using malloc glibc call.
There are 2 ways to obtain the memory allocated from the kernel. brk() and mmap() are the system calls corresponding to kernel functions. brk() maps to the kernel function sys_brk which just expands the dynamically allocated heap. the mmap system calls corresponds to do_mmap function call which allocates a specif area for dynamic use. This area is returned to the Malloc system call which then manages the area for specific data structures.
Monday, April 20, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment