This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix memory leak in printf_positional
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: Carlos O'Donell <carlos at redhat dot com>, Paul Eggert <eggert at cs dot ucla dot edu>, GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Mon, 31 Aug 2015 10:41:39 +0000
- Subject: Re: [PATCH] Fix memory leak in printf_positional
- Authentication-results: sourceware.org; auth=none
- References: <1440571295-20230-1-git-send-email-eggert at cs dot ucla dot edu> <alpine dot DEB dot 2 dot 10 dot 1508260930500 dot 26898 at digraph dot polyomino dot org dot uk> <55DFB7C7 dot 50307 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1508281350520 dot 5939 at digraph dot polyomino dot org dot uk> <55E06924 dot 2000209 at redhat dot com> <CALoOobMkGafD9zvq9g13TM8_Nd+HmC58_8gMGTQhdefXpko3CA at mail dot gmail dot com>
On Sat, 29 Aug 2015, Paul Pluzhnikov wrote:
> It doesn't take very long: all I needed is a printf invocation with >=
> 65536 / 3 / sizeof(void*) arguments.
>
> Writing such invocation by hand is of course toublesome, plumbing
> Makefile to generate it for me, and figuring out why it doesn't work
> is what takes time :-(
Normally such invocations would be generated with macros, e.g.
#define A a, a, a, a, a, a, a, a, a, a
#define B A, A, A, A, A, A, A, A, A, A
etc., unless the sort of expansion you require is unsuited to that for
some reason.
> In addition, there is a GCC regression: compiling a printf call with
> 2800 arguments takes 4.8.4-2ubuntu1~14.04 0.06s without optimization,
> 0.86s with -O2. Same numbers for current GCC trunk (@r227321): 0.06s
> and 4m46s. This is on a very recent and fast PC. I expect there could
> be PCs in current use where the time will be 3x longer.
To me this suggests building the test with -O0 (or -fno-<something>, if
the responsible optimization has been identified and can be disabled that
way), with a comment in the Makefile pointing to the GCC bug and naming a
GCC version as of which it appears (and a version as of which it is fixed,
if applicable).
--
Joseph S. Myers
joseph@codesourcery.com