lkml.org 
[lkml]   [1998]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    Subjectfork returning Out of Memory (2.1.128)
    While running following programs, after forking about 350 process, 
    fork() returns Out of Memory, whereas I still have 576kbytes RAM free
    and 96Mbytes free swap.

    #include <errno.h>

    main()
    {
    int i = 1;
    for (;;) {
    int pid;
    if (!(pid = fork()))
    for (;;)
    sleep(3600);
    if (pid == -1) {
    printf("fork() returned %s\n", strerror(errno));
    sleep(1);
    } else
    printf("Forked %dth process(%d)\n", i++, pid);
    }
    }


    Nov 21 20:48:51 asterix kernel: SysRq: Show Memory
    Nov 21 20:48:51 asterix kernel: Mem-info:
    Nov 21 20:48:51 asterix kernel: Free pages: 576kB
    Nov 21 20:48:51 asterix kernel: ( Free: 144 (48 96 144)
    Nov 21 20:48:51 asterix kernel: 144*4kB 0*8kB 0*16kB 0*32kB 0*64kB
    0*128kB = 576kB)
    Nov 21 20:48:51 asterix kernel: Swap cache: add 9564/9564, delete
    9524/9524, find 0/0
    Nov 21 20:48:51 asterix kernel: Free swap: 96424kB
    Nov 21 20:48:51 asterix kernel: 6144 pages of RAM
    Nov 21 20:48:51 asterix kernel: 594 reserved pages
    Nov 21 20:48:51 asterix kernel: 9865 pages shared
    Nov 21 20:48:51 asterix kernel: 40 pages swap cached
    Nov 21 20:48:51 asterix kernel: 0 pages in page table cache
    Nov 21 20:48:51 asterix kernel: Buffer memory: 1228kB
    Nov 21 20:48:51 asterix kernel: Buffer heads: 1264
    Nov 21 20:48:51 asterix kernel: Buffer blocks: 1228
    Nov 21 20:48:51 asterix kernel: CLEAN: 453 buffers, 40 used
    (last=40), 0 locked, 0 protected, 0 dirty
    Nov 21 20:48:51 asterix kernel: LOCKED: 766 buffers, 53 used
    (last=761), 0 locked, 0 protected, 0 dirty
    Nov 21 20:48:51 asterix kernel: Networking buffers in use :
    0
    Nov 21 20:48:51 asterix kernel: Total network buffer allocations :
    1009
    Nov 21 20:48:51 asterix kernel: Total failed network buffer allocs :
    0
    Nov 21 20:48:51 asterix kernel: IP fragment buffer size :
    0


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:45    [W:0.028 / U:11.592 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site