Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6336917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:09:06+00:00 2026-05-24T19:09:06+00:00

So I have an object which represents a line drawn on the iPhone screen.

  • 0

So I have an object which represents a line drawn on the iPhone screen. I also have a ball moving around on the screen, and when the ball and the line intersect, the string is given a life. For my current build I am receiving this error constantly, with no crashes, but the ball stops moving on the screen:

2011-08-18 11:00:05.436 myProgram[192:5e03] * __NSAutoreleaseNoPool(): Object 0x1531c0 of class NSCFString autoreleased with no pool in place – just leaking

Line.h:
@interface Line : NSObject {

//time properties
NSTimeInterval life;
NSDate *startTime;
NSDate *currentTime;
}



//time properties
@property (nonatomic, retain) NSDate *startTime;


-(void) updateLife;

-(void) beginLifeTracking;

@end

Line.m

@synthesize startTime;

-(void)beginLifeTracking {
[self.startTime release]; //not sure if self is necessary here but startTime is released
                          //in case the same string is hit again
self.startTime = [NSDate date];
startTime = [NSDate dateWithTimeIntervalSince1970:0];
//NSLog(@"Time Interval: %f",startTime);
}


-(void) updateLife {
currentTime = [[NSDate date] retain];
NSLog(@"breakpoint1");   
life = [currentTime timeIntervalSinceDate:self.startTime];
[currentTime release];
}  

I’m assuming this is some sort of memory management error, but all my attempts to remedy it have failed. I’d really appreciate an explanation of what I’m doing wrong here. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:09:09+00:00Added an answer on May 24, 2026 at 7:09 pm

    When you call [self.startTime release], you’re over-releasing. It’s the job of the accessor (setStartTime:) to do this release.

    The code doesn’t make any sense, and is dangerous since it leaves a dangling ivar:

    currentTime = [[NSDate date] retain];
    NSLog(@"breakpoint1");   
    life = [currentTime timeIntervalSinceDate:self.startTime];
    [currentTime release];
    

    This should be:

    self.life = [[NSDate date] timeIntervalSinceDate:self.startTime];
    

    The fact that you’re getting an autoreleasepool error suggests you’re running this on a background thread. Your code is not thread-safe, so that would be a problem.

    EDIT Regarding threading code, how are you calling beginLifeTracking? That would be where I would suspect you’re getting onto the wrong thread. I would be very concerned about this autoreleasepool warning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a List<HashMap<String,Object>> which represents a database where each list record is a
I have an object which holds a stack of objects. The object represents the
I have a domain object which represents a 1:n relationship between database tables. public
I have an event object which has from_date as a field which represents when
Say I have a Class object which represents an anonymous inner class. Is there
In PHP with DOM, I have a DomElement object which represents an <identity/> element.
I have a superclass object which represents a model in a scene. This object
I have an Entity Framework object which represents a telephone call. How can I
I have object A which in turn has a property of type Object B
I have object A which contains multiple instances of object B, which in turn

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.