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/2226] Memory leak in fputws


------- Additional Comments From drepper at redhat dot com  2006-02-03 21:55 -------
The virtual address space size printed in the /proc information is no correct
measure of memory used.  These are heuristics which apparently use size of the
page table tree.  But with randomized mmap addresses this is worthless.

Change the second program to repeat the fopen/flcose sequence a reasonable
number of times.  Say 10 times.  Then run the program with strace.  Each
iteration should look like this:

open("./x.txt", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
fstat(3, {st_mode=S_IFREG|0664, st_size=8964, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2acbc5e87000
fstat(3, {st_mode=S_IFREG|0664, st_size=8964, ...}) = 0
lseek(3, 8964, SEEK_SET)                = 8964
lseek(3, 0, SEEK_CUR)                   = 8964
fstat(3, {st_mode=S_IFREG|0664, st_size=8964, ...}) = 0
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2acbc5eac000
write(3, "AAAAAAAAA", 9)                = 9
close(3)                                = 0
munmap(0x2acbc5eac000, 4096)            = 0
munmap(0x2acbc5e87000, 4096)            = 0

I.e., both buffers are deallocated.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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

------- 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]