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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:31:10+00:00 2026-06-03T20:31:10+00:00

I’m playing a system sound using… NSString *path = [NSString stringWithFormat:@%@%@, [[NSBundle mainBundle] resourcePath],

  • 0

I’m playing a system sound using…

    NSString *path = [NSString stringWithFormat:@"%@%@",
                      [[NSBundle mainBundle] resourcePath],
                      @"/heartbeat.wav"];

    //declare a system sound id
    SystemSoundID soundID4;

    //Get a URL for the sound file
     NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];

    //Use audio sevices to create the sound
    AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)filePath, &soundID4);

    //Use audio services to play the sound
    AudioServicesPlaySystemSound(soundID4);

    AudioServicesDisposeSystemSoundID(soundID4);

I’m not sure that this is the problem.. but if it run with “analyze” it comes up as a potential leak. There is clearly some kind of leak going on as the app gets slower and slower as I run it more times in the simulator. I have found examples for how to deal with this without using arc, but nothing with. Any suggestions would be greatly appreciated.

  • 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-03T20:31:11+00:00Added an answer on June 3, 2026 at 8:31 pm

    “it comes up as a potential leak”. What is “it”?

    Second, you don’t analyze a memory leak by observing a program getting slower and slower. In fact, that’s not a normal symptom of a memory leak unless you are exhausting physical RAM and causing lots of swapping. You diagnose a leak by actually identifying no-longer-reachable memory using something like the Leaks instrument.

    That said, you don’t want __bridge_retained, you just want __bridge. One of the reasons I prefer the CFBridgingRetain() and CFBridgingRelease() functions rather than the __bridge_retained and __bridge_transfer casts is that you are much less likely to make such a mistake. For example, you’d never have written:

    AudioServicesCreateSystemSoundID(CFBridgingRetain(filePath), &soundID4);
    

    First of all, it’s obvious that there’s no need to retain filePath just to pass it to a function. Second, calling a CFRetain()-style function also makes it clear that you have a responsibility to calling a CFRelease()-style function to balance it.

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

Sidebar

Related Questions

I am starting using FMOD API and I have got problem with sound playing.
I am playing around with DisqusSharp: using System; using System.Collections.Generic; using System.Linq; using System.Text;
Ok so I'm playing around with a nested comments system on rails using Awesome
I am currently playing with Qt trying to set up a small particle system.
I'm playing around with a composite control that uses the ASP.NET templating system. I
The idea I'm playing with right now is having a multi-leveled tier system of
iam trying to record sound from an activex WMP control playing an internet radio
When I try to play the sound file Windows Critical Stop.wav I get the
I am playing around with the new System.ComponentModel.Composition namespace in .NET 4.0 beta 2,
I am playing around with the System.ComponentModel.DataAnnotations namespace, with a view to getting some

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.