[m-rev.] for review: Use mmap for Boehm GC in threaded grades on Linux.

Julien Fischer jfischer at opturion.com
Tue Jul 29 17:44:03 AEST 2014


On Fri, 25 Jul 2014, Peter Wang wrote:

> Branches: master
>
> Maybe configure should set MR_HAVE_SBRK in mercury_conf.h just for
> thread_sbrk?

You can if you like; there's no particular cost in doing so.

> ---
>
> The glibc implementation of malloc (commonly used on Linux) can use sbrk
> to acquire more memory, and so does Boehm GC in its default configuration
> on Linux.  When both allocators are invoked simultaneously from different
> threads then memory corruption may result.
>
> configure.ac:
> 	Add --enable-gc-mmap option.
>
> 	Make --enable-gc-munmap imply --enable-gc-mmap.
>
> 	Detect mmap and set MR_HAVE_MMAP.
>
> 	On Linux (and potentially other platforms), build Boehm GC for
> 	threaded grades with -DUSE_MMAP if mmap was found.
>
> Mmake.common.in:
> 	Add ENABLE_BOEHM_USE_MMAP.
>
> runtime/mercury_conf.h.in:
> 	Add MR_HAVE_MMAP, although it is not used anywhere yet.
>
> tests/hard_coded/thread_sbrk.m:
> 	Add test program.  This is not wired into the build system
> 	because we do not otherwise check for the existence of sbrk.
>
> NEWS:
> 	Announce changes.

That looks fine.

Cheers,
Julien.



More information about the reviews mailing list