babblishu / project-lemon

Automatically exported from code.google.com/p/project-lemon
0 stars 0 forks source link

关于内存使用的问题 #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
评测的时候无论是Windows还是Linux对内存使用的计算都不准确��
�. 有一个开了100+MB内存的程序, 测出来才20M左右

Original issue reported on code.google.com by tigermo...@gmail.com on 8 May 2012 at 11:30

GoogleCodeExporter commented 9 years ago
这个问题有些复杂……
首先Windows和Linux都有虚拟内存技术,程序开数组的时候是申��
�虚拟内存,然后在运行的时候如果使用到了,才会映射到物�
��内存,并且Windows和Linux都使用懒惰策略。
例如你开了一个长度1000000的数组,只用了前100000个元素,那�
��实际使用的物理内存只有前100000个元素占用的空间。
Lemon显示出来的内存使用量是PrivateWorkingSet(Windows),也就是在�
��理内存中的占用量。但是Lemon同时也会检测申请的虚拟内存�
��否超过内存限制(Windows和Linux下都会)。
你可以试试看将内存限制调整到64MB,这个开了100MB+数组的程�
��应该是会MLE的。

Original comment by Blue.Boy.in.China@gmail.com on 28 May 2012 at 12:34