OS memory allocation addresses
Posted
by
user1777914
on Stack Overflow
See other posts from Stack Overflow
or by user1777914
Published on 2012-11-08T22:19:44Z
Indexed on
2012/11/08
23:00 UTC
Read the original article
Hit count: 344
Quick curious question, memory allocation addresses are choosed by the language compiler or is it the OS which chooses the addresses for the memory asked?
This is from a doubt about virtual memory, where it could be quickly explained as "let the process think he owns all the memory", but what happens on 64 bits architectures where only 48 bits are used for memory addresses if the process wants a higher address?
Lets say you do a int a = malloc(sizeof(int));
and you have no memory left from the previous system call so you need to ask the OS for more memory, is the compiler the one who determines the memory address to allocate this variable, or does it just ask the OS for memory and it allocates it on the address returned by it?
© Stack Overflow or respective owner