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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:15:23+00:00 2026-05-15T08:15:23+00:00

NSString* str = [[NSString alloc] initWithString:@0.05]; NSDecimalNumber* num = [[NSDecimalNumber alloc] initWithString:str]; NSLog(@ %@,

  • 0
NSString* str = [[NSString alloc] initWithString:@"0.05"];
NSDecimalNumber* num = [[NSDecimalNumber alloc] initWithString:str];
NSLog(@" %@", num);
[str release];
[num release];

leaks memory

*** __NSAutoreleaseNoPool(): Object 0x707990 of class NSCFString autoreleased with no pool in place - just leaking

Can someone suggest a workaround ?

  • 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-15T08:15:23+00:00Added an answer on May 15, 2026 at 8:15 am

    What others said; wrap your code with an NSAutoreleasePool. An NSAutoreleasePool is actually surprisingly efficient; will incur very little overhead. You don’t want to, say, surround every few lines of code with one, but it is unlikely that they’ll be measurable in normal use.

    Do not try to use Foundation without Autorelease Pools

    Down that path lies madness. Don’t bother. Sure — it is sometimes a good idea to put some effort into minimizing use of pools, but there will be many cases — like this one — where they are unavoidable.

    No, really, I’m not kidding:

    Cocoa always expects there to be an autorelease pool available. If a pool is not available, autoreleased objects do not get released and you leak memory. If you send an autorelease message when a pool is not available, Cocoa logs a suitable error message.


    I have C++ communication library
    written many years ago. It calls back
    every time there is network event
    (sometimes in a newly created thread).
    Your advise had disastrous effect on
    the performance of my application.

    My answer wasn’t advice, it was a very specific description of the exact rules by which the Cocoa frameworks are implemented. That your code worked before was by coincidence. While there is certainly a behavior change, it isn’t a regression for code that is following the rules.

    Arbitrary threading like that is exceedingly risky within Cocoa (well, really, anywhere). I’ve done such integrations a number of times and have generally found the best solution to be to handle the events in one or more queue like mechanisms, depending on concurrency needs. The queues can then take care of periodically dealing with autorelease pools.

    Of course, the truly arbitrary threading you describe would need some mechanism to move the data over to the queue’s thread(s)….

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

Sidebar

Ask A Question

Stats

  • Questions 534k
  • Answers 534k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Rebuilding the project from scratch a third time solved this… May 17, 2026 at 12:54 am
  • Editorial Team
    Editorial Team added an answer The items in a combobox can be of any object… May 17, 2026 at 12:54 am
  • Editorial Team
    Editorial Team added an answer The compiler option "-debug=true" does the job. Like this: mxmlc… May 17, 2026 at 12:54 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a C function with the following method signature. NSString* md5( NSString *str
example: word with number in string NSString *str = [NSString stringWithFormat:@this is an 101
I am having following condition: @interface MyClass:NSObject @public NSString *str; @end @implementation -(id)init{ }
Assume I have a method with the signature: + (NSString *) myFormattedString:(NSString *)format, ...;
imagine an xml file with 5000 sets of data. While parsing , i NSLog
I'm trying to wrap NSLog function just to add some info every time I
I have written this function which shuffles the contents of a NSString , and
I am going through Cocoa Programming for Mac OS X by Aaron Hillegrass and
Just couple of days i was working on a project and i have to
I know there are a lot of questions on this topic already, but it

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.