This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
memory handling in qsort
- To: <glibc-linux at ricardo dot ecn dot wfu dot edu>
- Subject: memory handling in qsort
- From: Allin Cottrell <cottrell at wfu dot edu>
- Date: Mon, 5 Mar 2001 11:45:21 -0500 (EST)
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
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):
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