cvs commit: src/lib/libc/sys mmap.2

Dag-Erling Smørgrav des at des.no
Fri Mar 24 21:13:36 UTC 2006


Julian Elischer <julian at elischer.org> writes:
> Dag-Erling Smørgrav wrote:
> > Are you saying that mmap() is not constrained by maxdsiz?
> that seems to be the case from my experience.

That's bad.  Our new malloc() uses mmap() to allocate arenas, which
means that dsiz no longer has any effect.  I've just confirmed this:

# phkmalloc on 5.4 / i386
% ulimit -d
524288
% ./allocate
511

# jemalloc on 7.0 / i386
% ulimit -d
524288
% ./allocate
697

# jemalloc on 7.0 / amd64
% ulimit -d
524288
% ./allocate
1844^C

Note the discrepancy on 7.0 / i386 - it does stop, but only after
exceeding dsiz by about 50%.  On amd64, it'll happily keep going until
it hits vsiz, which is unlimited by default.

DES
-- 
Dag-Erling Smørgrav - des at des.no

-------------- next part --------------
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	int i = 0;

	while (malloc(1048576) != NULL) {
		printf("\r%d", ++i);
		fflush(stdout);
	}
	printf("\n");
	exit(0);
}


More information about the cvs-src mailing list