首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >iPhone: OpenAL和AudioToolbox泄漏

iPhone: OpenAL和AudioToolbox泄漏
EN

Stack Overflow用户
提问于 2010-10-01 15:42:54
回答 1查看 3.4K关注 0票数 7

我使用OpenAL在我的应用程序中播放声音。当我使用Instruments工具测试它时,它发现了一个漏洞:

LeakedObject =通用块-512

大小= 512字节

责任库= AudioToolbox

Responsible Frame = AU3DMixerEmbeddedInputElement::Initialize()

堆栈跟踪:

代码语言:javascript
运行
复制
   0 libSystem.B.dylib malloc
   1 libstdc++.6.dylib operator new(unsigned long)
   2 libstdc++.6.dylib operator new[](unsigned long)
   3 AudioToolbox AU3DMixerEmbeddedInputElement::Initialize()
   4 AudioToolbox AU3DMixerEmbedded::SetProperty(unsigned long, unsigned long, unsigned long, void const*, unsigned long)
   5 AudioToolbox AUBase::DispatchSetProperty(unsigned long, unsigned long, unsigned long, void const*, unsigned long)
   6 AudioToolbox AUMethodSetProperty(void*, unsigned long, unsigned long, unsigned long, void const*, unsigned long)
   7 OpenAL OALContext::InitializeMixer(unsigned long)
   8 OpenAL OALContext::OALContext(unsigned long, OALDevice*, int const*, unsigned long&, double&)
   9 OpenAL alcCreateContext
  10 myApp -[myAudioManager initOpenAL] /Users/kpower/Documents/projects/myApp/Classes/myAudioManager.m:197
  11 myApp -[myAudioManager init] /Users/kpower/Documents/projects/myApp/Classes/myAudioManager.m:83
  12 myApp +[myAudioManager sharedInstance] /Users/kpower/Documents/projects/myApp/Classes/myAudioManager.m:316
  13 myApp -[myMainMenu viewDidLoad] /Users/kpower/Documents/projects/myApp/Classes/myMainMenu.m:46
  14 UIKit -[UIViewController view]
  15 UIKit -[UIViewController contentScrollView]
  16 UIKit -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:]
  17 UIKit -[UINavigationController _layoutViewController:]
  18 UIKit -[UINavigationController _startTransition:fromViewController:toViewController:]
  19 UIKit -[UINavigationController _startDeferredTransitionIfNeeded]
  20 UIKit -[UINavigationController viewWillLayoutSubviews]
  21 UIKit -[UILayoutContainerView layoutSubviews]
  22 UIKit -[UIView(CALayerDelegate) _layoutSublayersOfLayer:]
  23 CoreFoundation -[NSObject(NSObject) performSelector:withObject:]
  24 QuartzCore -[CALayer layoutSublayers]
  25 QuartzCore CALayerLayoutIfNeeded
  26 QuartzCore -[CALayer layoutIfNeeded]
  27 UIKit -[UIView(Hierarchy) layoutIfNeeded]
  28 UIKit -[UIViewController window:willAnimateRotationToInterfaceOrientation:duration:]
  29 UIKit -[UIWindow _setRotatableClient:toOrientation:duration:force:]
  30 UIKit -[UIWindow _setRotatableViewOrientation:duration:force:]
  31 UIKit -[UIWindow _updateToInterfaceOrientation:duration:force:]
  32 UIKit -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:]
  33 UIKit -[UIWindow setDelegate:]
  34 UIKit -[UIViewController _tryBecomeRootViewControllerInWindow:]
  35 UIKit -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]
  36 UIKit -[UINavigationController viewDidMoveToWindow:shouldAppearOrDisappear:]
  37 UIKit -[UIView(Internal) _didMoveFromWindow:toWindow:]
  38 UIKit -[UIView(Hierarchy) _postMovedFromSuperview:]
  39 UIKit -[UIView(Internal) _addSubview:positioned:relativeTo:]
  40 UIKit -[UIView(Hierarchy) addSubview:]
  41 myApp -[myAppAppDelegate applicationDidFinishLaunching:] /Users/kpower/Documents/projects/myApp/Classes/myAppAppDelegate.m:19
  42 UIKit -[UIApplication _callInitializationDelegatesForURL:payload:suspended:]
  43 UIKit -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:]
  44 UIKit -[UIApplication handleEvent:withNewEvent:]
  45 UIKit -[UIApplication sendEvent:]
  46 UIKit _UIApplicationHandleEvent
  47 GraphicsServices PurpleEventCallback
  48 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
  49 CoreFoundation __CFRunLoopDoSource1
  50 CoreFoundation __CFRunLoopRun
  51 CoreFoundation CFRunLoopRunSpecific
  52 CoreFoundation CFRunLoopRunInMode
  53 UIKit -[UIApplication _run]
  54 UIKit UIApplicationMain
  55 myApp main /Users/kpower/Documents/projects/myApp/Classes/../main.m:13
  56 myApp start

initOpenAL中的代码(靠近197行):

代码语言:javascript
运行
复制
device = alcOpenDevice(NULL);
if (NULL == device) return NO;

context = alcCreateContext(device, 0);  // line 197 - tried using NULL instead of 0 - same result
if (NULL == context) return NO;

alcMakeContextCurrent(context);  

它不是关键的(它不会时不时地重复,消耗内存),但是我如何修复它?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-10-03 04:00:18

我认为这是库本身的问题,因为我也遇到了问题,其他人也报告了同样的问题。这要归咎于苹果。希望他们能很快解决这个问题。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3837294

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档