• 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: ObjectAlloc and objects that should have been released
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjectAlloc and objects that should have been released


  • Subject: Re: ObjectAlloc and objects that should have been released
  • From: Peter N Lewis <email@hidden>
  • Date: Thu, 23 Apr 2009 13:46:28 +0800

On 23/04/2009, at 10:19 , Miles wrote:
I have a timer that continues calling a method that for the moment (testing
purposes) only contains:
NSArray *tmp = [NSArray arrayWithArray:animatingTilesArray];


The time is setup like this:
animationTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self
selector:@selector(doAnimation:) userInfo:nil repeats:YES];


When I run this in ObjectAlloc, it shows that every instance of the 'tmp'
array created above is 'created and still living'. Considering it's an
auto-released array shouldn't there only be zero or one still living?

If you are only running a timer, you may be running in to the issue described at:


<http://www.cocoabuilder.com/archive/message/cocoa/2008/12/16/225553>

The run loop autorelease pool is not released for timer events.

If so, you should see all your objects disappear as soon as you do a UI action in your app, like click the mouse.

You have two possible solutions:

* Periodically post an event to your app.
* Create and release an NSAutoreleasePool in your timer method.

Enjoy,
   Peter.


-- Run macros from your iPhone with Keyboard Maestro Control! or take a break with Derzle for your iPhone

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
Aragom Space War <http://www.stairways.com/iphone/aragom> Don't get killed!
Derzle <http://www.stairways.com/iphone/derzle> Enjoy a relaxing puzzle.
<http://www.stairways.com/> <http://download.stairways.com/>





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: ObjectAlloc and objects that should have been released
      • From: Miles <email@hidden>
References: 
 >ObjectAlloc and objects that should have been released (From: Miles <email@hidden>)

  • Prev by Date: Re: How to: many users edit same file at the same time ?
  • Next by Date: Re: Accuracy of timers?
  • Previous by thread: ObjectAlloc and objects that should have been released
  • Next by thread: Re: ObjectAlloc and objects that should have been released
  • Index(es):
    • Date
    • Thread