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 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 491k
  • Answers 491k
  • 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 It depends upon a number of things, but what you… May 16, 2026 at 10:06 am
  • Editorial Team
    Editorial Team added an answer In MySQL, regular expressions can match but not return substrings.… May 16, 2026 at 10:06 am
  • Editorial Team
    Editorial Team added an answer The common approach would be to check it with a… May 16, 2026 at 10:06 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'm using: NSData *output1 = [NSData dataWithContentsOfFile:@~/centralUtilOut.tmp]; NSString *output = [[NSString alloc]initWithData:output1 encoding:NSUTF8StringEncoding]; NSLog(@%@,
I have a C function with the following method signature. NSString* md5( NSString *str
Let's say I'm writing a DayData class, containing the ivars NSString *symbol; //such as
Assume I have a method with the signature: + (NSString *) myFormattedString:(NSString *)format, ...;
NSString *myRequestString = [NSString stringWithFormat:@&nbr=%@&import=%@,tmpString,noSpaces]; NSData *myRequestData = [ NSData dataWithBytes: [ myRequestString UTF8String
I have a NSString *csvData which contains the csv data and the format is
Getting a NSString as follows: NSString *lastSyncDate = [[items objectAtIndex:0] objectForKey:@LastSyncDate]; This value is:
//Seperate into arrays NSString *NumberItems = [RawMessage componentsSeparatedByString:@|]; //Create the strings NSString *number1 =
i have an NSString that is value in plist format. i download this string
I'm looking for the best way to check that an NSString contains both numerical

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.