mprotect fails error when using memory debugging with guard pages

This can happen if your program makes more than 32768 allocations; a limit in the kernel prevents Linaro DDT from allocating more protected regions than this.

Solution

Try these options to resolve the issue:

  • Run echo 123456 >/proc/sys/vm/max_map_count (requires root) which increases the limit to 61728 (123456/2, because some allocations use multiple maps).

  • Disable guard pages completely. This hinders the ability of Linaro DDT to detect heap over/underflows.

  • Disable guard pages temporarily. You can disable them at program start, add a breakpoint before the allocations you wish to add guard pages for, and then re-enable the feature.

See Configuration in Memory debugging for information on how to disable guard pages.