Re: 2.6.9, 64bit, 4GB memory => panics ...

From: Adam Heath (doogie_at_debian.org)
Date: 12/05/04

  • Next message: Dan Kegel: "Re: Proposal for a userspace "architecture portability" library"
    Date:	Sun, 5 Dec 2004 01:20:14 -0600 (CST)
    To: Rudolf Usselmann <rudi@asics.ws>
    
    

    On Sun, 5 Dec 2004, Rudolf Usselmann wrote:

    > int mem[10000];
    > int i, n;
    >
    > for(i=0;i<2000;i++) {
    > printf("Doing alloc %0d ...\n",i);
    > mem[i] = (int)malloc(1024*1024*1024);

    allocate a 1 gig block, but store it in an int array? That's wrong.

    > if(mem[i] == NULL)
    > printf("Malloc failed ...\n");
    > else
    > for(n=0;n<(1024*1024*1024);n=n+640) mem[i] = n;

    You alter n, but then always only set mem[i], without varying i.

    Your program is buggy, and memleaks.

    Plus, the kernel uses overcommit by default, and since you aren't actually
    touching the memory you are allocating, you are only limited by the address
    space size allowed per process(depends on how you configured the kernel).

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


  • Next message: Dan Kegel: "Re: Proposal for a userspace "architecture portability" library"

    Relevant Pages

    • Re: [Lhms-devel] RE: memory hotremove prototype, take 3
      ... > address without needing to do anything more than allocate a page frame ... IA32 kernel often uses __PAGE_OFFSET. ... Even if we use Mr. Iwamoto's method use, some memories will remain. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • serverworks usb under 2.4.22
      ... board uses the Serverworks chipset and the 2.4.22 kernel is unable to ... allocate an IRQ when initializing the USB interface. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Why "PCI: Cannot allocate resource region..."?
      ... I didn't get any response to my previous query, so I figured I'd ask a ... why would the kernel say that it cannot allocate a ... *does* the kernel decide it can't do the allocation? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • kmalloc usage question
      ... sleep. ... * %GFP_KERNEL - Allocate normal kernel ram. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Linux kernels DoSable by file-max limit
      ... > kernel keeps some additional file slots reserved for the root user. ... Then if you allocate all the ram into files you ... will run the machine oom at some point. ...
      (Bugtraq)