This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/3973] New: malloc_stats/struct mallinfo is not 64bits ready


the struct mallinfo has its field of type `int' making it wrap on 64bits 
architectures (amd64 e.g.).

an obvious test case is:

----8<------------------
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>

#define CHUNK  0x40000000

int main(void) {
    ssize_t size = 0;
    int i;

    for (i = 0; i < 5; i++) {
        void *p = malloc(CHUNK);

        if (p) {
            size += CHUNK;
            fprintf(stderr, "Chunk %d: [total %dMb]\n", i, (int)(size >> 20));
            malloc_stats();
            fputc('\n', stderr);
        }
    }

    return 0;
}
---->8------------------

===============================================================
make a ; ./a
cc     a.c   -o a
Chunk 0: [total 1024Mb]
Arena 0:
system bytes     =          0
in use bytes     =          0
Total (incl. mmap):
system bytes     = 1073745920
in use bytes     = 1073745920
max mmap regions =          1
max mmap bytes   = 1073745920

Chunk 1: [total 2048Mb]
Arena 0:
system bytes     =          0
in use bytes     =          0
Total (incl. mmap):
system bytes     = 2147491840
in use bytes     = 2147491840
max mmap regions =          2
max mmap bytes   = 2147491840

Chunk 2: [total 3072Mb]
Arena 0:
system bytes     =          0
in use bytes     =          0
Total (incl. mmap):
system bytes     = 3221237760
in use bytes     = 3221237760
max mmap regions =          3
max mmap bytes   = 3221237760

Chunk 3: [total 4096Mb]
Arena 0:
system bytes     =          0
in use bytes     =          0
Total (incl. mmap):
system bytes     =      16384
in use bytes     =      16384
max mmap regions =          4
max mmap bytes   = 4294983680

Chunk 4: [total 5120Mb]
Arena 0:
system bytes     =          0
in use bytes     =          0
Total (incl. mmap):
system bytes     = 1073762304
in use bytes     = 1073762304
max mmap regions =          5
max mmap bytes   = 5368729600


FYI it's debian bug http://bugs.debian.org/336608

-- 
           Summary: malloc_stats/struct mallinfo is not 64bits ready
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: madcoder at debian dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3973

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]