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 7705141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:48:52+00:00 2026-05-31T23:48:52+00:00

I am experiencing memory leaks linked to NSMutableArray’s in a project configured to use

  • 0

I am experiencing memory leaks linked to NSMutableArray’s in a project configured to use ARC, which I thought was supposed to handle these things for you.

The following code is triggering leaks of NSNumbers:

NSMutableArray *myArray = [[NSMutableArray alloc] init];

NSNumber  *myNumber = [NSNumber numberWithFloat:10];

[myArray addObject:myNumber];

Running the last line gives the following in the debugger:

objc[1106]: Object 0x765ffe0 of class __NSCFNumber autoreleased with no pool in place – just leaking – break on objc_autoreleaseNoPool() to debug

Aside from that, the object appears to be correctly added to the mutable array,

Am I doing something obvious wrong?

Note: There is one class in the project which I could not get to work with ARC, and so I excluded it from ARC using the compiler flag -fno-objc-arc. However, the leaks are occurring in other classes that are using ARC. Not sure if that is related.

Many thanks for your 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-05-31T23:48:53+00:00Added an answer on May 31, 2026 at 11:48 pm

    You’re probably running this code on a background thread, and don’t have an autorelease pool in place. ARC will still autorelease objects for you on occasion, and if you’re calling into Apple frameworks, they may still be non-ARC, so they definitely could be autoreleasing objects for you. So you still need an autorelease pool in place.

    Cocoa creates an autorelease pool for you on the main thread, but doesn’t do anything for you on background threads. If you’re going to kick something off onto a background thread without using NSOperation or something, you’ll want to wrap that thread in an @autoreleasepool, like so:

    - (void)doSomething {
        [self performSelectorInBackground:@selector(backgroundSomething)];
    }
    
    - (void)backgroundSomething {
        @autoreleasepool {
            NSLog(@"Here I am in the background, doing something.");
            myArray = [[NSMutableArray alloc] init];
            // etc.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im experiencing a strange situation which i was supposed to handle. The situation is:
I'm experiencing an increase of memory usage, when I use the jQuery-eventhandling in Chrome.
I am experiencing memory leaks in an ASP.Net MVC 3 application and I suspect
I am experiencing an enormous memory leak in my WPF project and am trying
I'm experiencing a memory leak when using WMI from Delphi 7 to query a
I've been working on a .NET application and experiencing a memory error (I'm a
My application is multithreaded with intensive String processing. We are experiencing excessive memory consumption
I'm experiencing a strange PNG issue in my as3 flash project. I am loading
I'm developing a Flex application with BlazeDS and I'm experiencing memory leak when using
I was experimenting with ways to get rid of some memory leaks within my

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.