• 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
sizeWithAttributes not actually leaking
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 >


  • Follow-Ups:
    • Re: sizeWithAttributes not actually leaking
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: global default for NSLayoutManager selection threshold?
  • Next by Date: memory and launching
  • Previous by thread: Re: retainCount-what about debugging(Dave Mattson)
  • Next by thread: Re: sizeWithAttributes not actually leaking
  • Index(es):
    • Date
    • Thread