为什么Valgrind的限制为32 GB的64位体系结构? [英] Why is valgrind limited to 32 Gb on 64 bit architectures?
问题描述
我想Valgrind的一个heisenbug上的进程,它使用超过32 GB的RAM,并创下该Valgrind的限制,这是一个任意一个可避免重新编译的valgrind或者是一个很难?
I'm trying to valgrind a heisenbug on a process which uses more than 32 Gb of ram and hitting this valgrind limitation, is this an arbitrary one that could be avoided by recompiling valgrind or is it a hard one?
推荐答案
限制是任意的,可以通过重新编译Valgrind的改变。
The limit is arbitrary and can be changed by recompiling valgrind.
Valgrind的跟踪用的2级稀疏数组存储器。地址的16位用于索引到含有一个指向第二级地图,追踪一个范围的地址空间的65536条目表(通常2 16字节= 64KB为32位进程,2¹⁹字节= 512KB为64位进程)。这样的存储器中,可以通过该2级稀疏数组被跟踪的总量为65536×这个块大小。通过修改code,这些块的大小可以增加为2的较大的功率,在用多个存储器跟踪大部分局部块的成本。
Valgrind keeps track of memory using a 2-level sparse array. 16 bits of the address are used to index into a 65536-entry table containing a pointer to a second-level map, which tracks a range of the address space (normally 2¹⁶ bytes = 64KB for 32-bit processes, 2¹⁹ bytes = 512KB for 64-bit processes). So the total amount of memory that can be tracked by this 2-level sparse array is 65536 × this chunk size. By modifying the code, the size of these chunks can be increased to a larger power of 2, at the cost of using more memory to track most partial chunks.
在在Valgrind的用户邮件列表这个讯息,朱利安苏厄德介绍了如何增加限制从32GB到128GB:
In this message on the valgrind-users mailing list, Julian Seward explains how to increase the limit from 32GB to 128GB:
-
在
的Memcheck / mc_main.c
变更N_PRIMARY_BITS
从19
到21
在的Memcheck / mc_main.c
年底改变据此断言:
-
MAX_PRIMARY_ADDRESS
→4 *(现值+ 1) - 1 - 为
MASK(1/2/4/8)
断言,为0时,最右边的2 在领先1位,如块1位MASK(8)
→0xFFFFFFE000000007ULL
我觉得
MAX_PRIMARY_ADDRESS
→ 4 * (existing value + 1) - 1- for the
MASK(1/2/4/8)
assertions, set to zero the rightmost two '1' bits in the block of leading 1 bits, egMASK(8)
→0xFFFFFFE000000007ULL
I think
在 coregrind / m_aspacemgr / aspacemgr-linux.c
变更 aspacem_maxAddr
从
(地址)0x800000000 - 1
到(地址)0x2000000000ULL - 1
这篇关于为什么Valgrind的限制为32 GB的64位体系结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!