Subject: port-vax/7859: VAX port doesn't handle "out of memory" state correctly.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bdc@world.std.com>
List: netbsd-bugs
Date: 06/26/1999 14:23:54
>Number:         7859
>Category:       port-vax
>Synopsis:       VAX port doesn't handle "out of memory" state correctly.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-vax-maintainer (NetBSD/vax Portmaster)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 26 14:20:01 1999
>Last-Modified:
>Originator:     Brian Chase
>Organization:
>Release:        NetBSD-1.4
>Environment:
	VAXstation 3100/M76 w/16MB RAM, NetBSD/vax 1.4
System: NetBSD vaxzilla 1.4 NetBSD 1.4 (BVAX) #0: Sun Jun 13 16:11:43 PDT 1999 root@futplex:/usr/src/sys/arch/vax/compile/BVAX vax


>Description:
	The above system was setup with no swap space in order to help
	isolate some suspected swapping problems which result in machine
	hangs.  I discovered that although UVM catches and kills memory
	hungry processes when the system runs out of memory, it doesn't
	handle this condition gracefully.  As soon as UVM reports killing
	the process, the system hangs.
>How-To-Repeat:
Example code to generate the problem follows:
---
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int count = 1;
    int delta = 1024*1024;
    void *fooptr;
    unsigned char *ptr;
    int i;

    while (1) {
        printf("allocating: %dMB\n", count);
        fooptr = malloc((size_t)delta*count);
        printf("writing to: %dMB\n", count);
        ptr = (unsigned char *)fooptr;
        for (i = 0 ; i < delta*count ; i++ ) {
           *ptr++ = (unsigned char)0xff;
        }
        printf("deallocate: %dMB\n", count);
        free(fooptr);
        count++;
    }

    exit(0);
}

>Fix:
>Audit-Trail:
>Unformatted: