This is the mail archive of the mailing list for the GCC 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]

Mudflap and freeing C runtime memory upon exit (feature request)


I have a feature request for mudflap. It should have an option to run glibc's _libc_freeres function that forces the C runtime library to free all of its memory and does not leave that task to the underlying OS. When instrumented with mudflap, the following program reports upon exit tens of memory leaks, e.g. 58 leaks under one of several GNU/Linux distributions I have tested on, similar results on others. (Be sure to set the MUDFLAP_OPTIONS environment variable to "-print-leaks"; the program is, of course, built with "gcc -g -fmudflap <program name> -lmudflap".) The gcc versions used are the 4.1.1 final and latest official release and 4.2.0 20060729 on x86 (not x86-64).

#include <netdb.h>

// void __libc_freeres();

int main()
	// atexit(__libc_freeres);
	return 0;

Now, if the two lines are uncommented, mudflap does not report the leaks, but unfortunately it produces an equal amount of "mudflap warning: unaccessed registered object" warnings. With several lines printed for each of the tens of warnings, the console is swamped with text. There does not seem to exist a mudflap option to suppress this type of warning, and, in this case, it probably does not make sense to be suppressed, but rather something should be corrected on the mudflap / C runtime library side.

So, in short, what I request is the equivalent of the memory debugger Valgrind's option "--run-libc-freeres". The option defaults to yes, but can be set to no, because, according to the Valgrind documentation, some older versions of glibc segfault when __libc_freeres is called.



Should I submit in the GCC Bugzilla? There are 2 other problems, strictly problems, not feature requests, I have submitted there.

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