0
我正在ARMv7-A计算机上运行应用程序,Fedora 18,2GB内存。mmap2未能为线程分配堆栈,但在GDB下工作
应用程序终止:
130413 15:49:34 19344 Xrd: PhyConnection: Can't run reader thread: out of system resources. Critical error.
如果我strace
,我看到堆栈分配一个新的线程失败:
mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = -1 ENOMEM (Cannot allocate memory)
gettimeofday({1365921367, 588018}, NULL) = 0
gettid() = 6309
writev(2, [{"130414 02:36:07 6309 ", 21}, {"Xrd", 3}, {"", 0}, {": ", 2}, {"PhyConnection: Can't run reader "..., 80}, {"\n", 1}], 6130414 02:36:07 6309 Xrd: PhyConnection: Can't ru
n reader thread: out of system resources. Critical error.
) = 107
munmap(0x48172000, 292) = 0
munmap(0x48225000, 292) = 0
实际代码:
253 if (fReaderthreadhandler[i]->Run(this)) {
254 Error("PhyConnection",
255 "Can't run reader thread: out of system resources. Critical error.");
256 // HELP: what do we do here
257 exit(-1);
258 }
的应用程序的虚拟内存大小为300-350MB,而驻留内存大小为〜250MB。高内存限制为1.3GB。虚拟地址空间不受限制:
-t: cpu time (seconds) unlimited
-f: file size (blocks) unlimited
-d: data seg size (kbytes) unlimited
-s: stack size (kbytes) 8192
-c: core file size (blocks) 0
-m: resident set size (kbytes) unlimited
-u: processes 1024
-n: file descriptors 1024
-l: locked-in-memory size (kbytes) 64
-v: address space (kbytes) unlimited
-x: file locks unlimited
-i: pending signals 15870
-q: bytes in POSIX msg queues 819200
-e: max nice 0
-r: max rt priority 0
-N 15: unlimited
但它确实从GDB工作!我也看了GDB报道的限制,他们是一样的。因此,GDB不会调整将被继承的软限制。
摘要:
- 我有足够的内存来运行应用程序。它甚至可以在GDB内正常工作。
- 它似乎并没有达到任何资源限制。
- 在广东发展局工作,但不在外面。
这里有什么可能是错误的提示?
[Fedora 18](http://en.wikipedia.org/wiki/List_of_Fedora_versions#Fedora_18)是Linux 3.6.10 –
你试过'ulimit -s unlimited'吗?显然,** MAP_STACK **应该不重要,但限制为8M。这只是一个猜测。很明显,'mmap'失败了,所以我想理解为什么内核返回* ENOMEM *。 ** GDB **可能会改变程序设置,如堆栈。 –
除了总内存消耗之外,还有更多限制:'ENOMEM没有内存可用,或者进程的最大映射数量已被超过。 – wildplasser