Subject: system unresponsive with big malloc and memory initialisation
To: NetBSD amd64 <port-amd64@netbsd.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: port-amd64
Date: 06/15/2004 14:22:46
Hi,
While playing on my amd64 workstation (2 Opterons 246, 1GB of Ram),
running NetBSD -current (20040614); i noticed that the system became
unresponsive for a few seconds with a small program that try to
allocate and initialize about 800MB. Looks similar to the previous
`pagedaemon' problem under low memory conditions recently fixed ...
The same test on an i386 machine does not exhibit this behaviour.
load averages: 1.78, 1.76, 1.07 14:03:08
52 processes: 51 sleeping, 1 on processor
CPU0 states: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle
CPU1 states: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle
Memory: 237M Act, 4312K Wired, 18M Exec, 218M File, 556M Free
Swap: 4096M Total, 24M Used, 4073M Free
njoly@lanfeust [~]> time ./maxmem
len = 838860800
ptr = 0x513000
cool :]
./maxmem 0.00s user 0.01s system 51% cpu 0.019 total
njoly@lanfeust [~]> time MALLOC_OPTIONS=J ./maxmem
len = 838860800
ptr = 0x513000
cool :]
MALLOC_OPTIONS=J ./maxmem 0.36s user 1.98s system 33% cpu 7.045 total
njoly@lanfeust [~]> cat maxmem.c
#include<stdio.h>
#include<stdlib.h>
int main() {
char *p;
size_t len;
len = 800 * 1024 * 1024;
printf("len = %lu\n", len);
p = malloc(len);
if (p == NULL) {
printf("ARGH :[\n");
exit(1); }
printf("ptr = %p\n", p);
printf(" cool :]\n");
exit(0); }
Thanks in advance,
Regards.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.