我知道有些内存泄漏没有什么大不了,或者不在开发人员的控制范围之内,因为它们在sdk本身,但我看到的是iOS 4上的iOS版本为32KB SDK 4.2。我还没有能够在3GS上触发此功能。它发生在响应用户交互(响应打开照片库,并且泄漏似乎在我进入照片库时发生),因此它可以快速建立起来。iPhone内存泄漏
这里的堆栈跟踪我看到的iPhone 4:
0 libSystem.B.dylib calloc
1 0x317e8363
2 0x317e9c41
3 0x318273ff
4 0x31827ea5
5 0x302ea49d
6 0x302ebe07
7 0x302eb7c3
8 0x302ebcab
9 0x303304cd
10 UIKit -[UINavigationController _startTransition:fromViewController:toViewController:]
11 UIKit -[UINavigationController _startDeferredTransitionIfNeeded]
12 UIKit -[UINavigationController viewWillLayoutSubviews]
13 UIKit -[UILayoutContainerView layoutSubviews]
14 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
15 CoreFoundation -[NSObject(NSObject) performSelector:withObject:]
16 QuartzCore -[CALayer layoutSublayers]
17 QuartzCore CALayerLayoutIfNeeded
18 QuartzCore CA::Context::commit_transaction(CA::Transaction*)
19 QuartzCore CA::Transaction::commit()
20 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
21 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
22 CoreFoundation __CFRunLoopDoObservers
23 CoreFoundation __CFRunLoopRun
24 CoreFoundation CFRunLoopRunSpecific
25 CoreFoundation CFRunLoopRunInMode
26 GraphicsServices GSEventRunModal
27 GraphicsServices GSEventRun
28 UIKit -[UIApplication _run]
29 UIKit UIApplicationMain
30 MyApp main /Users/david/src/MyApp/main.m:14
31 MyApp start
我没有看到我的代码的任何地方,并在这里,我不知道该怎么检查与地址的符号是什么。有任何想法吗?这可能与我添加的子层有关吗? (这是我在这里看到的唯一可以控制的东西。)
感谢您的帮助。
编辑:古栈的问题,指出(谢谢你,古栈),我完全忘了提,这是表示文书起来:
Leaked Object # Address Size Responsible Library Responsible Frame
GeneralBlock-36864 0x4ff3000 36864 UIKit -[UINavigationController _startTransition:fromViewController:toViewController:]
你怎么知道有内存泄漏?是在控制台中出现的消息?你可以在你的问题中粘贴控制台输出吗? – 2010-12-11 19:44:32