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

CMemoryValgrind

C Problem Overview


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)

C Solutions


Solution 1 - C

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJimmy LuView Question on Stackoverflow
Solution 1 - CTomHView Answer on Stackoverflow