This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: malloc using mprotect


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]