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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:39:19+00:00 2026-06-01T22:39:19+00:00

In my code i am working with audio buffers, when i have a callback

  • 0

In my code i am working with audio buffers, when i have a callback function that is being called many times per second. this callback is in a class that handle audio, and not in the main class of the app .

At the start i was getting this warning that is being log many times during callbacks:

Object 0x93cd5e0 of class __NSCFNumber autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() 

Then i was told to put this line in the callback func :

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

then this error disappeared .
But i cant understand how is that possible that i alloc the pool so many times in 1 second- and maybe i have a memory issues.
I saw than that i have to put this at the end :

[pool drain];

so i have this :

OSStatus status;
    status = AudioUnitRender(audioUnit, 
                             ioActionFlags, 
                             inTimeStamp, 
                             inBusNumber, 
                             inNumberFrames, 
                             &bufferList); 


    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  // that line added

    //run on evert sample
    int16_t *q = (int16_t *)(&bufferList)->mBuffers[0].mData;
    for(int i=0; i < inNumberFrames; i++)
    {
    static int stateMachineSelector=1;
    static int sampelsCounter=0;

   // CODE TO HANDLE THE SAMPLES ...
    }
   [pool drain];  // issue here    

what exactly i did here?
why is that ?
is that ok from memory aspect ?

thanks a lot .

  • 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-01T22:39:21+00:00Added an answer on June 1, 2026 at 10:39 pm

    When starting a Autorelease pool with [[NSAutoreleasePool alloc] init] all further objects receiving a autorelease or where created with the convenience allocator (like NSArray *ary = [NSArray array];, or UIView *view = [[[UIView alloc] init] autorelease]; are in that pool.

    So:

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSArray *ary = [NSArray array];
    [pool release]; // this will also release and dealoc the *ary from memory
    

    If you have a callback running NOT no the main thread, you SHOULD do a new pool. If not, your objects may leek to nirvana. 🙂

    If you process a lot of data with autorelease objects and you’d like to free the memory, then create a pool, process, release the pool.

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

Sidebar

Related Questions

I have this code working in C#: var request = (HttpWebRequest)WebRequest.Create(https://x.com/service); request.Method = GET;
I have this JQuery code working however I need to know whether how to
I used to have this code working with my Tomcat server: HttpRequestBase targetRequest =
I have code for simple audio player on android. But it is not working
I have a bit of code: $('.audio_player embed').each(function() { $(this).attr('wmode','transparent').wrap('<div></div>'); console.log($(this)); }); What this
Why isn't this code working? I've been stuck on this for 2 days. public
We have the following code working for a complex rails form with checkboxes. I'm
i got this code working and it to return the last tweet from my
Right now I have the following code working: @UiHandler(usernameTextBox) void onUsernameTextBoxKeyPress(KeyPressEvent event) { keyPress(event);
I have my current google maps code working to the point where if I

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.