这个警告意味着什么?-警告设置地址范围烫发

当我运行我的程序来对抗 valground 时,我遇到了以下警告。

Warning: set address range perms: large range [0x4d59d040, 0x6159d040) (undefined)
Warning: set address range perms: large range [0x194f7030, 0x2d4f7050) (noaccess)
Warning: set address range perms: large range [0x3959d030, 0x6159d050) (noaccess)

经过一些谷歌我发现在 给你是一个 Diagnostic message, mostly for benefit of the Valgrind developers, to do with memory permissions,这并没有告诉我太多。

我的程序确实在堆上分配了大量的内存。(可以达到2-3GB 的内存后,一整束的 realloc的)

然而,尽管没有一次分配失败,警告还是出现了。

因此,我想知道这个消息到底是什么意思? 我没有某种内存权限? (但是分配成功了)

39595 次浏览

It just means that the permissions changed on a particularly large block of memory.

That can happen because of something like a call to mprotect or when a very large memory allocation or deallocation occurs - an mmap or munmap call for example.

The first one you list is setting about 320Mb of memory to undefined which is most likely a new allocation, which will be marked as undefined initially. The others are both setting similar sized blocks to noaccess which probably relates to a deallocation of memory.