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

  • Home
  • SEARCH
  • 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 8806685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:11:11+00:00 2026-06-14T02:11:11+00:00

I was doing a debug on an application I’m creating, but running instruments I

  • 0

I was doing a debug on an application I’m creating, but running instruments I found a memory leak that I can’t be able to understand.

If I try to modify the code following Instruments suggestion, my application crashes because of

message sent to deallocated instance

Can someone help me?

- (void) objectAtIndex:(int)index {
    SpecialObject *specialObj = [SpecialObject sharedInstance];

    id model = [self.datasource objectAtIndex:index];

    if ([model isKindOfClass:[ClassA class]]) {
        ClassA *objA = (ClassA *)model;
        specialObj.title = objA.title;

    } else if ([model isKindOfClass:[ClassB class]]) {
        ClassB *objB = (ClassB *)model;
        specialObj.title = objB.title;
    }
}

self.datasource is a NSMutableArray while specialObj.title is a NSString

They are defined as @property(nonatomic, retain).

My problem is that Instruments tells me that these 2

ClassA *objA = (ClassA *)model;
ClassB *objB = (ClassB *)model;

are leaks, but if I release objA and objB my application crash.

Thanks for any help!

  • 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-06-14T02:11:12+00:00Added an answer on June 14, 2026 at 2:11 am

    After some search I’ve found the problem: XCode usually tells where the leaks are, but some times it give you a probable position for it.

    This means that the memory leak is somewhere in the program flow the goes to the point XCode indicates, not necessarily exactly where it says.

    Hope this can help someone else in the future!

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

Sidebar

Related Questions

I am creating an application that can get text from the selected rectangle on
How can i debug when application works without error in emulator but force closes
I have a directory in my application called /admin/debug/output that contains a directory and
I'm trying to debug a locally running java web start application. There is a
As I debug my seam application, it dawns on me that I don't really
When i debug my application, it gives an error that SelectCommand.Connection Property is not
I am doing remote debugging of a Java application and using the debug view
I am not able to debug asp.net application in asp.net 2.0 Whenever I hit
I am doing a standart getHibernateTemplate().saveOrUpdate() in Spring Hibernate application, but function never returns
I'm doing a patch to solve a progress bar issue in an application that

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.