This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu 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]

Re: memory handling in qsort


Allin Cottrell <cottrell@wfu.edu> writes:

> I'm wondering if I might have found a small memory leak in qsort, in
> glibc 2.2.1.
> 
> I'm memory-checking an application of mine, and when a large data set
> is given to qsort I'm seeing a 6-byte leak.  My first assumption was
> that this is a side-effect of an error in my program, but when I
> couldn't track down the error I tried running the same program, with
> the same data, on two different systems.  No leak was reported on a
> GNU/Linux system with glibc-2.1.3, while a leak was reported on a
> GNU/Linux system running glibc-2.2.1.  The trace looked like this
> (from yamd):

There's no leak in qsort - check
sysdeps/unix/sysv/linux/getsysstats.c.  If you're malloc debugging,
you have to call (see how it's done in malloc/*) the free_mem function
in that file.

Andreas

> WARNING: Memory leak
> Address 0x40294ffa, size 6
> Allocated by malloc at
> BEGIN TRACEBACK
> /lib/libc.so.6(malloc+0x2e)[0x4013e842]
> /lib/libc.so.6(__strdup+0x66)[0x40143eba]
> /lib/libc.so.6(ustat+0x128)[0x401977ac]
> /lib/libc.so.6(get_nprocs+0x161)[0x40197951]
> /lib/libc.so.6(get_phys_pages+0x1d)[0x40197aa1]
> /lib/libc.so.6(sysconf+0x3f1)[0x401737e5]
> /lib/libc.so.6(qsort+0x63)[0x400fbe63]
> /opt/esl/lib/libgretl.so.2(summary+0x1cb)[0x40047cf7]
> /opt/esl/bin/gretlcli(strcpy+0x3342)[0x804d8b6]
> /opt/esl/bin/gretlcli(strcpy+0xc74)[0x804b1e8]
> /lib/libc.so.6(__libc_start_main+0xce)[0x400ea0ea]
> /opt/esl/bin/gretlcli(strcpy+0x3d)[0x804a5b1]
> END TRACEBACK
> 
> Allin Cottrell
> Wake Forest University
> 
> 
> 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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