r*******e 发帖数: 54 | 1 Have been wondering about this for a long time:
In Linux/Unix, how would a process decide the scope of it's virtual memory spa
ce? generally, shouldn't it be as large as the address-space allows?
using swap, why should there be "out of memory" error?
bow ....... | a**a 发帖数: 416 | 2 It is due to the allocation algorithm and the allocation pattern of your
program. In some algorithms, memories are organized in pages where one
page is the allocation unit for one request. Therefore, even a single
byte could consume 4k bytes in some program. In this way, the memory
could be exhausted very quick.
【在 r*******e 的大作中提到】 : Have been wondering about this for a long time: : In Linux/Unix, how would a process decide the scope of it's virtual memory spa : ce? generally, shouldn't it be as large as the address-space allows? : using swap, why should there be "out of memory" error? : bow .......
| r*******e 发帖数: 54 | 3
Thanks, this answers some questions
But I am still not clear how a program decides how much heap space does it nee
d, or the size of the whole virtual memory space that it will be running in...
. therotically, it could be much larger that the physical memory space if only
the address bits allow, then why should we get "out of memory" error so often
?
thanks,
【在 a**a 的大作中提到】 : It is due to the allocation algorithm and the allocation pattern of your : program. In some algorithms, memories are organized in pages where one : page is the allocation unit for one request. Therefore, even a single : byte could consume 4k bytes in some program. In this way, the memory : could be exhausted very quick.
| a**a 发帖数: 416 | 4 Well, a program does not claim all virtual addresses as its heap space.
Generally each program has a map of virtual addresses to valid memory space
claimed by the program. Therefore, OS will manage these maps.
Before a program could access some memory place, it must claim it, which
is done by some system call(s). Ideally the OS would try to meet requests until
all available virtual space exhausted. But due to some physical or design
limits, the OS might throw "out of memory" error by some imp
【在 r*******e 的大作中提到】 : : Thanks, this answers some questions : But I am still not clear how a program decides how much heap space does it nee : d, or the size of the whole virtual memory space that it will be running in... : . therotically, it could be much larger that the physical memory space if only : the address bits allow, then why should we get "out of memory" error so often : ? : thanks,
|
|