malloc using mprotect

Wolfram Gloger Wolfram.Gloger@dent.med.uni-muenchen.de
Fri Aug 10 07:11:00 GMT 2001


Hello,

> I think you want to use it instead of the first mprotect too, since
> otherwise consecutive new arenas will not be merged into one huge vma.

True..

> --- malloc/malloc.c.jj	Fri Jul 20 06:44:54 2001
> +++ malloc/malloc.c	Fri Aug 10 08:48:25 2001
> @@ -2050,7 +2050,8 @@ new_heap(size) size_t size;
>        return 0;
>      }
>    }
> -  if(mprotect(p2, size, PROT_READ|PROT_WRITE) != 0) {
> +  if(MMAP(p2, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED)
> +     == (char *) MAP_FAILED) {
>      munmap(p2, HEAP_MAX_SIZE);
>      return 0;
>    }

This would be fine with me.

Thanks,
Wolfram.



More information about the Libc-alpha mailing list