What Does This Valgrind Warning Mean? - warning set address range perms

Jimmy Lu picture Jimmy Lu · Nov 26, 2012 · Viewed 30.1k times · Source

When I was running my program against valgrind, I encountered the following warning.

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)

After some googling I found at here that it is a Diagnostic message, mostly for benefit of the Valgrind developers, to do with memory permissions, which doesn't tell me much.

My program does allocate a large amount of memory on heap. (Can reach 2-3 GB of ram after a whole bunch of realloc's)

However, the warning appeared despite none of the allocations failed.

So, I'm wondering what this message really means? I don't have some sort of memory permission? (But allocation succeeded)

Answer

TomH picture TomH · Nov 26, 2012

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.