[Bug stdio/21127] New: printf functions can take much memory with %g when the format precision is large

vincent-srcware at vinc17 dot net sourceware-bugzilla@sourceware.org
Fri Feb 10 16:24:00 GMT 2017


https://sourceware.org/bugzilla/show_bug.cgi?id=21127

            Bug ID: 21127
           Summary: printf functions can take much memory with %g when the
                    format precision is large
           Product: glibc
           Version: 2.24
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: vincent-srcware at vinc17 dot net
  Target Milestone: ---

On some easy cases, the printf functions take much memory when the precision in
the format string is large. For instance:

#include <stdio.h>
int main (void)
{
  for (int i = 20; i > 0; i--)
    printf ("%.300000000g\n", i + 0.5);
  return 0;
}

The printf function is fast on 20.5 to 10.5, but starting with 9.5, it becomes
very slow and takes much memory (about 1 GB on my Debian Linux x86_64 machine
with libc6 2.24), while these cases are very similar.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list