• 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
Re: [NSCalendar currentCalendar] leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSCalendar currentCalendar] leak


  • Subject: Re: [NSCalendar currentCalendar] leak
  • From: Mike Abdullah <email@hidden>
  • Date: Fri, 3 Nov 2006 19:11:13 +0000

Just for the archives, I implemented this category to fix the problem:

@implementation NSCalendar (RealCurrentCalendar)

// We are overriding the default implementation of currentCalendar since it leaks like a sieve.
+ (id)currentCalendar
{
NSString *localeIdentifier = [[NSLocale currentLocale] objectForKey: NSLocaleCalendar];

NSCalendar *currentCalendar =
[[[NSCalendar alloc] initWithCalendarIdentifier: localeIdentifier] autorelease];

return currentCalendar;
}


@end


On 1 Nov 2006, at 21:01, Mike Abdullah wrote:

Thanks Matt, I'll report it. Worries me slightly this bug though, especially since I know from experience that NSDateComponents doesn't conform to NSCoding.

Mike.

On 1 Nov 2006, at 00:01, Matt Neuburg wrote:

On Tue, 31 Oct 2006 23:03:51 +0000, Mike Abdullah <email@hidden>
said:
When testing my app using the leaks tool, I have an awful lot of
leaked NSCalendar instances.  However, in my code, I only ever call
[NSCalendar currentCalendar] which presumably should autorelease the
instance.

Does anyone know if I am missing something obvious here?

Yes, it is obvious to do a search on currentCalendar to see whether this is
known:


<http://www.cocoabuilder.com/archive/message/cocoa/2006/7/16/167714>

and it is obvious to add your voice to the list and help the community by
reporting this as a bug:


<https://bugreport.apple.com>

m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: [NSCalendar currentCalendar] leak (From: Mike Abdullah <email@hidden>)

  • Prev by Date: No selectedObjects After Insert:
  • Next by Date: Re: Odd textView behavior
  • Previous by thread: Re: [NSCalendar currentCalendar] leak
  • Next by thread: Re: [NSCalendar currentCalendar] leak
  • Index(es):
    • Date
    • Thread