[lkml]   [2001]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Subjectproblems with memory allocation

    I have some trouble with seg faults when allocating memory, and am too
    confused by that to find the right culprit...

    I created a linked list (with a FOR loop and same conditions for each
    element) and got a seg fault at 10th element. May happen, but now
    happens since days and always at the same 10th element. I tried around a
    bit to find out what could be the problem and stranded with an

    I wrote a loop from 0 to 100 and allocated memory with calloc to a char
    pointer each loop (at same place in code to keep it comparable):

    for (i = 0; i <= 100; i++){
    char pointer = (cast) calloc(1,bytes);
    printf("hier (means 'here' in german)\n");

    I got seg faults till up to 100 bytes per allocation at always the same
    overall allocated memory size (bytes * loops) (malloc, instead, works
    fine but using the faulty memory leads to seg fault too). When
    allocating 1000 bytes each loop I got no error. To me this means that
    there are some small faulty rests in memory that were overjumped when
    allocating more memory at once. But because I can overfill my memory
    with applications without any seg fault, and the error is always
    strictly the same (even after boot and with different amount of products
    running), I can't believe that it is my hardware. At least, other
    products don't step into this problem. May it be the vm?

    I use glibc 2.2.4 and gcc 2.95.3 on linux 2.4.13. I tried to compile
    2.4.14 but got an installation error:

    ld -m elf_i386 -T /usr/src/linux/arch/i386/ -e stext
    arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/main.o
    init/version.o \
    --start-group \
    arch/i386/kernel/kernel.o arch/i386/mm/mm.o kernel/kernel.o mm/mm.o
    fs/fs.o ipc/ipc.o \
    drivers/parport/driver.o drivers/char/char.o drivers/block/block.o
    drivers/misc/misc.o drivers/net/net.o drivers/media/media.o
    drivers/char/agp/agp.o drivers/char/drm/drm.o drivers/atm/atm.o
    drivers/ide/idedriver.o drivers/scsi/scsidrv.o drivers/cdrom/driver.o
    drivers/sound/sounddrivers.o drivers/pci/driver.o drivers/video/video.o
    drivers/input/inputdrv.o drivers/message/i2o/i2o.o drivers/i2c/i2c.o \
    net/network.o \
    /usr/src/linux/arch/i386/lib/lib.a /usr/src/linux/lib/lib.a
    /usr/src/linux/arch/i386/lib/lib.a \
    --end-group \
    -o vmlinux
    drivers/block/block.o: In function `lo_send':
    drivers/block/block.o(.text+0xa853): undefined reference to
    drivers/block/block.o(.text+0xa895): undefined reference to
    make: *** [vmlinux] Error 1

    The patch nr.5 for 2.4.15pre gives another compilation error:

    setup.c: In function `c_start':
    setup.c:2791: subscripted value is neither array nor pointer
    setup.c:2792: warning: control reaches end of non-void function
    make[1]: *** [setup.o] Error 1
    make[1]: Leaving directory `/usr/src/linux/arch/i386/kernel'
    make: *** [_dir_arch/i386/kernel] Error 2

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

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