Reasons why malloc is not recommended as a tool:
- Permits only set with the granularity page, but the memory obtained by malloc is unlikely to be the page aligned, and
therefore the permission setting in the adjacent memory will also be terminated, possibly breaking things or denying
permissions of access.
- If you do not reset the previous permissions before calling the free, you can break the inside of malloc.
Solution:
- Replace malloc () with mmap ().
- Replace free () with munmap ().
In my GNU / Linux system in particular (my dear CentOS Linux 6.7), the application is dropped with a message
"mprotect: permission denied.", It drove me crazy ehh !

I solved it with these replacements in a patch and until now, it works (and I already did several tests, ehh!)

If any of you have this problem, use it!
