I am exploring the lower level workings of the system, and was wondering how malloc
determines the start address of the heap. Is the heap at a constant offset or is there a call of some sort to get the start address? Does the stack affect the start address of the heap?
views:
100answers:
1
+1
A:
Traditionally, the heap started just above the text section and grew up; stack frames didn't affect start address at all as they grow down towards the unmapped 0 page. However, it's more common these days for
- The first address to be randomized, to make it harder for exploits to hit the right address in memory
- The heap to be non-contiguous, as
malloc()
usually just callsmmap()
to get an address anywhere in the virtual address space
Michael Mrozek
2010-04-28 04:54:57
Ah, I understand now. Thanks!
beta
2010-04-28 05:03:02