i was trying to tickle a kernel panic, but instead
i think i found a bug.  this program was run on
a machine with 1800 MB user space available.
(3552/464510 user)

        #include<u.h>
        #include<libc.h>
        
        enum{
                Big     = 1024*1024*1790,
        };
        
        void
        main(void)
        {
                char *p;
                ulong i;
        
                p = malloc(Big);
                if(p == 0)
                        sysfatal("malloc: %r");
                memset(p, 0, Big);
                exits("");
        }

the result was

        ladd# out of physical memory; no swap configured
        364: 8.out killed: out of memory

this means that the malloc *succeeded* it wasn't until i forced
the pagefault with the memset that i ran out of memory.  what's
going on here?

- erik

Reply via email to