Red Hat Bugzilla – Bug 50606
Threads break memusage
Last modified: 2016-11-24 10:12:26 EST
Description of Problem:
Running a threaded application with memusage causes a segmentation
violation in the memusage code.
See attachment (main.c) for a sample threaded application that breaks
Steps to Reproduce:
1. gcc -o main main.c
2. memusage ./main
3. OR memusage --no-timer ./main
$ memusage ./main
/usr/bin/memusage: line 1: 1837 Segmentation fault (core dumped)
$ memusage --no-timer ./main
/usr/bin/memusage: line 1: 1839 Segmentation fault (core dumped)
LD_PRELOAD=/lib/libmemusage.so MEMUSAGE_NO_TIMER=yes "$@"
Program runs to completion w/ histogram output of memory usage.
Will attach the source file shortly.
Created attachment 25792 [details]
A threaded application that breaks memusage.
A slight correction on building the main program...
gcc -o main main.c -lpthread
I also tried (just in case...)
gcc -D_REENTRANT -o main main.c -lpthread
and they continue to fail with the segmentation violation.
Should be fixed by http://sources.redhat.com/ml/libc-hacker/2001-08/msg00018.html.
This will appear probably in glibc-2.2.4-3.
Thanks for the fix. That certainly helps the start up problem but may
have uncovered another bug. I got the following output from a threaded
app that uses about 34 meg of memory...
Memory usage summary: heap total: 30733622, heap peak: 30731086, stack peak:
total calls total memory failed calls
malloc| 312 30732854 0
realloc| 0 0 0 (in place: 0, dec: 0)
calloc| 6 768 0
free| 15 2536
Note the "stack peak" at about 2G. Should I submit this as a new bug?
Red Hat Linux and Red Hat Powertools are currently no longer supported by Red
Hat, Inc. In an effort to clean up bugzilla, we are closing all bugs in MODIFIED
state for these products.
However, we do want to make sure that nothing important slips through the
cracks. If, in fact, these issues are not resolved in a current Fedora Core
Release (such as Fedora Core 5), please open a new issues stating so. Thanks.