Subject: kern/34586: amap can eat too much memory
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 09/22/2006 14:50:00
>Number:         34586
>Category:       kern
>Synopsis:       amap can eat too much memory
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 22 14:50:00 +0000 2006
>Originator:     YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
>Release:        NetBSD 3.99.16
>Organization:
	
>Environment:
	
	
System: NetBSD bear.yamanet 3.99.16 NetBSD 3.99.16 (build.bear2) #34: Wed Mar 15 21:07:26 JST 2006 takashi@kaeru:/home/takashi/work/kernel/build.bear2 i386
Architecture: i386
Machine: i386
>Description:
	for some workloads, amap eats unreasonable amount of memory.

>How-To-Repeat:

#include <stdio.h>
#include <unistd.h>

#define	P	4096
#define	X	(2*1024*P)

int
main()
{
	char *p = sbrk(0);
	int i;

	for (i = X; i += P * 16;) {
		p += i;
		brk(p);
		p -= i - P;
		brk(p);
	}
}

>Fix:

	implement amap shrinking?

>Unformatted: