sizeWithAttributes not actually leaking
sizeWithAttributes not actually leaking
- Subject: sizeWithAttributes not actually leaking
- From: email@hidden
- Date: Sat, 6 Oct 2001 15:27:40 -0400
On Thursday, October 4, 2001, at 09:26 AM, <email@hidden> wrote:
I'm getting leaks in [NSString sizeWithAttributes: ]; for instance.
For what it's worth, I just spent many hours fretting over the apparent
leak in NSString's -sizeWithAttributes.
It appears that what happens is that sizeWithAttributes is caching the
strings its getting the size of. If you call it repeatedly with
identical strings (but each still being uniquely created and destroyed),
there is no "leak." If you call it repeatedly with unique strings,
ObjectAlloc reveals that multiple "NSConcreateAttributedString"s and an
equal number of "NSRLEArray"s are being created but not destroyed.
It goes on line this for somewhere between 100 and 300 invocations, so
you have 100-300 of these objects laying around, then they all get
flushed away. It took me a while to figure that out.
< Nathan Lamont / www.biggerplanet.com >