• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
(no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


  • Subject: (no subject)
  • From: Paul Fox <email@hidden>
  • Date: Thu, 11 Jul 2002 13:53:37 +0100

To: email@hidden
Subject: Re: VERY BAD: Memory leak in printf?
X-Mailer: Created by CRiSP-Mail v6.3 (CRiSP v8.0.6b)
Date: Thu, 11 Jul 2002 13:20:25 +0000

> If I run 'leaks' on my running app, I appear to get memory
> leaks from inside printf:
>
> abridged stack trace:
>
> -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] | -[NSView _drawRect:clip:] | -[CrispVi
> ew drawRect:] | printf | vfprintf | cvt | __dtoa | malloc | malloc_zone_malloc
>
> Is this a false report? Known bug in printf? Nothing to worry about?
>
> thanx

Oh dear. This is a _very_bad_ memory leak in printf.
I tried some simple code, such as:

printf("%d\n", i);

in a loop. No bug.

I tried:

printf("%g\n", f);

in a loop. No bug.

The bug appears to be if more than one float spec is used. The following
chews memory like there is no tomorrow. I'll see if I can raise a bug
on it if I can find the page:

int main(int argc, char **argv)
{ int i = 0, j;
float f = 0;

while (1) {
for(j = 0; j < 1000; j++, i++, f++)
printf("%d %u %x %g,%g,%g,%g\n",
i, i, i, f, f, f, f);
sleep(1);
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: (no subject)
      • From: Nick <email@hidden>
  • Prev by Date: Re: NSTask, NSFileHandle, readInBackgroundAndNotify and avoiding polling
  • Next by Date: Re: NSTask, NSFileHandle, readInBackgroundAndNotify and avoiding polling
  • Previous by thread: Re: (no subject)
  • Next by thread: Re: (no subject)
  • Index(es):
    • Date
    • Thread