malloc(3)
があなたに嘘をついていることに注意してください - それは実際に一度にすべてのメモリを割り当てません、それはちょうどそれのためにOSを要求し、OSはmalloc(3)
に位置しています。これは、ほとんどの時間が正常に動作する完全に正常な動作です。 proc(5)
で/proc/sys/vm/overcommit_memory
の説明は詳細が含まれています
/proc/sys/vm/overcommit_memory
This file contains the kernel virtual memory
accounting mode. Values are:
0: heuristic overcommit (this is the default)
1: always overcommit, never check
2: always check, never overcommit
In mode 0, calls of mmap(2) with MAP_NORESERVE are not
checked, and the default check is very weak, leading
to the risk of getting a process "OOM-killed". Under
Linux 2.4 any nonzero value implies mode 1. In mode 2
(available since Linux 2.6), the total virtual address
space on the system is limited to (SS + RAM*(r/100)),
where SS is the size of the swap space, and RAM is the
size of the physical memory, and r is the contents of
the file /proc/sys/vm/overcommit_ratio.
Valgrindのはとても軽薄にすることはできません。プロセスのために割り当てられ、初期化され、初期化されていないメモリを実際に追跡します。そのため、プロセスはそれ自身で行うよりも以上のメモリを必要とし、オーバーコミットメモリには同じ許容誤差がありません。
valgrindの下でプログラムを実行するのにどれだけのメモリが必要かわかりませんが、もう少しギガバイトのスワップ領域を追加してみてください。あなたは新しいスワップを作ることができますファイルdd
を使用してファイルにゼロを書き込みます - スパースファイルを使用しないでください - そしてmkswap(8)
をファイル上で実行してファイルを初期化し、ファイル名でswapon(8)
を実行して使用するように指示しますそれはスワップファイルとして。
Valgrindは、多くのVMを使用して残りのVMを追跡します。 – bmargulies
このシステムにはどのくらいのRAMがありますか?何十ギガバイトですか? – Linuxios