简体   繁体   English

允许进程使用超过4GB的RAM

[英]Allowing a process to use more than 4GB RAM

I am running a 64-bit Ubuntu 12.04 on a machine with 8GB RAM. 我在具有8GB RAM的计算机上运行64位Ubuntu 12.04。 I wrote a C++ program that I compiled with the -m64 (force 64-bit executable) flag in gcc . 我编写了一个C ++程序,该程序使用gcc的-m64(强制执行64位可执行文件)标志进行gcc I checked that the resulting executable is indeed 64-bit. 我检查了生成的可执行文件确实是64位。

However, the process caps at using 4GB RAM. 但是,该过程限制为使用4GB RAM。 How can I allow it to use more? 如何允许它使用更多?

Edit: output of ulimit -a 编辑: ulimit -a输出

ulimit -a
core file size          (blocks, -c) 0

data seg size           (kbytes, -d) unlimited

scheduling priority             (-e) 0

file size               (blocks, -f) unlimited

pending signals                 (-i) 62900

max locked memory       (kbytes, -l) 64

max memory size         (kbytes, -m) unlimited

open files                      (-n) 1024

pipe size            (512 bytes, -p) 8

POSIX message queues     (bytes, -q) 819200

real-time priority              (-r) 0

stack size              (kbytes, -s) 8192

cpu time               (seconds, -t) unlimited

max user processes              (-u) 62900

virtual memory          (kbytes, -v) unlimited

file locks                      (-x) unlimited

Edit 2: link to output of dstat -cdgms --vm 编辑2:链接到dstat -cdgms --vm的输出

https://www.dropbox.com/s/927s5x6v4bhp4qs/dstat_log.xlsx?dl=0 https://www.dropbox.com/s/927s5x6v4bhp4qs/dstat_log.xlsx?dl=0

As best as I can tell, adding the -m64 compilation flag (force 64 bit executable) actually solved my initial problem (app crashing), and what followed was a coincidence that my app actually required so little memory over 4GB (limit for a 32-bit executable) that it showed up as 4GB flat in System Monitor. 据我所知,添加-m64编译标志(强制使用64位可执行文件)实际上解决了我的最初问题(应用崩溃),随后发生的巧合是我的应用实际上只需要很少的4GB以上内存(限制为32 GB)位可执行文件),它在系统监视器中显示为4GB。 Thank you to all who contributed, there are a number of things in the comments that might help people trying to diagnose similar issues. 感谢所有贡献者,注释中有许多内容可能会帮助尝试诊断类似问题的人们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM