由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - a question about virtual memory
相关主题
Question about a TICPP example【请教】在家里用2个router上网(一前一后)的问题 (转载)
问一个跟 memory (process address space) 的有关的问题 (转载)cpp指针地址是virtual memory address还是physical address?
linux内存分配中page的几个问题这个怎么allocate memory?
"brk()" 和 mmap() 有什么区别? (转载)recommend a good memory allocator
想问一下,大家一般是怎么在windows 上装 centos, ubuntu 等的?gdb with big core file
how much slower: heap vs stack memory allocation?为什么virtual memory的0地址不能给用户程序访问
哪位在Linux上用C++碰到过memory fragmentation吗?What is automatic space allocation in C++?
matlab textscan data loading limit再问一个弱问题:为什么程序地址0-0x08000000是不可用的 (转载)
相关话题的讨论汇总
话题: memory话题: virtual话题: space话题: program话题: some
进入Programming版参与讨论
1 (共1页)
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,

1 (共1页)
进入Programming版参与讨论
相关主题
再问一个弱问题:为什么程序地址0-0x08000000是不可用的 (转载)想问一下,大家一般是怎么在windows 上装 centos, ubuntu 等的?
java heap space out 问题 (转载)how much slower: heap vs stack memory allocation?
effective C++里的memory pool 一问:哪位在Linux上用C++碰到过memory fragmentation吗?
why do we still use dynamic allocation?matlab textscan data loading limit
Question about a TICPP example【请教】在家里用2个router上网(一前一后)的问题 (转载)
问一个跟 memory (process address space) 的有关的问题 (转载)cpp指针地址是virtual memory address还是physical address?
linux内存分配中page的几个问题这个怎么allocate memory?
"brk()" 和 mmap() 有什么区别? (转载)recommend a good memory allocator
相关话题的讨论汇总
话题: memory话题: virtual话题: space话题: program话题: some