iPhone内存错误 - 使用Build&调试,如何调试?

时间:2010-01-27 00:38:50

标签: iphone debugging memory simulator

我是新手,需要一些在模拟器上运行的iPhone App的帮助。该应用程序与Build& amp;运行或构建&运行 - 断点关闭,但在使用Build& amp;调试 - 断点。任何帮助或想法将不胜感激。 Lon

细节:没有断点设置,永远不会得到任何可见的模拟器结果,似乎在初始化阶段爆炸,然后才能产生任何输出。应用程序的来源是DrinkMixer的例子,Dan& amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; Tracey Pilone。

发出此错误消息:

Attaching to process 970.
Pending breakpoint 1 - "*0x01c1b001" resolved
Program received signal:  “EXC_BAD_ACCESS”.
No memory available to program now: unsafe to call malloc
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)
No memory available to program now: unsafe to call malloc
---
Leaks:
The only object noted as "leaked Object" is:
Leaked Object   #   Address Size    Responsible Library Responsible Frame
Malloc 128 Bytes <blank> 0x3c11950   128Bytes   CoreGraphics    open_handle_to_dylib_path
___

Object Allocations shows (Highest at top = CFString):

Category   --- Overall Bytes  --  #Overall    -- Live Bytes --  #Living
* All Allocations * 497kb      #5888    496kb   #5878   10
CFString                42kb     #1126   42kb       
Malloc  32.00 KB    32kb     #1     32kb
Malloc 1.00 KB  29kb     #29        29kb
Malloc 8.00 KB  24kb     #3     24kb    
Malloc 32 Bytes 20.81kb  #666   20.75kb
Malloc 1.50 KB  19.5kb    #13       19.5kb 
CFDictionary (key-store)    17.64kb  #159  17.64kb 

(note:  Except for "All Allocations, the  #Living is the same as #Overall)
---

List of Calls from Debugger:

#0  0x01c1b010 in CFStringCreateByCombiningStrings
#1  0x023a0779 in LoadFontPathCache
#2  0x023a096b in Initialize
#3  0x023a0f3e in GSFontCreateWithName
#4  0x003d4575 in +[UIFont boldSystemFontOfSize:]
#5  0x002cddaa in +[UINavigationButton defaultFont]
#6  0x002d9e37 in -[UINavigationButton initWithValue:width:style:barStyle:possibleTitles:tintColor:]
#7  0x002cdc75 in -[UINavigationButton initWithImage:width:style:]
#8  0x00468eeb in -[UIBarButtonItem(Static) createViewForNavigationItem:]
#9  0x002d1b56 in -[UINavigationItem customRightView]
#10 0x002d20e3 in -[UINavigationItem updateNavigationBarButtonsAnimated:]
#11 0x002d1e1a in -[UINavigationItem setRightBarButtonItem:]
#12 0x00002e7b in -[RootViewController viewDidLoad] at RootViewController.m:41
#13 0x00313796 in -[UIViewController view]
#14 0x00311d92 in -[UIViewController contentScrollView]
#15 0x0031c2b4 in -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:]
#16 0x0031b32e in -[UINavigationController _layoutViewController:]
#17 0x0031cd1a in -[UINavigationController _startTransition:fromViewController:toViewController:]
#18 0x0031831a in -[UINavigationController _startDeferredTransitionIfNeeded]
#19 0x004362e4 in -[UILayoutContainerView layoutSubviews]
#20 0x035342b0 in -[CALayer layoutSublayers]
#21 0x0353406f in CALayerLayoutIfNeeded
#22 0x035338c6 in CA::Context::commit_transaction
#23 0x0353353a in CA::Transaction::commit
#24 0x00295ef9 in -[UIApplication _reportAppLaunchFinished]
#25 0x0029bb88 in -[UIApplication handleEvent:withNewEvent:]
#26 0x002976d3 in -[UIApplication sendEvent:]
#27 0x0029e0b5 in _UIApplicationHandleEvent
#28 0x023a3ed1 in PurpleEventCallback
#29 0x01bb6b80 in CFRunLoopRunSpecific
#30 0x01bb5c48 in CFRunLoopRunInMode
#31 0x00295e69 in -[UIApplication _run]
#32 0x0029f003 in UIApplicationMain
#33 0x00002ba0 in main at main.m:14

包括第41行(下面提到)的代码如下。感谢格式化帮助和评论:

#import "RootViewController.h"  
#import "DrinkDetailViewController.h";
#import "DrinkConstants.h"
#import "AddDrinkViewController.h"
@implementation RootViewController
@synthesize drinks, addButtonItem;
- (void)viewDidLoad {
    [super viewDidLoad];    
    //  add PATH for PLIST  
    NSString *path = [[NSBundle mainBundle] pathForResource:
                      @"DrinkDirections"  ofType:@"plist"]; 
    NSMutableArray *tmpArray = [[NSMutableArray alloc]                              initWithContentsOfFile:path];   
    self.drinks = tmpArray; 
    [tmpArray release];

// Next is Line #41 - I removed earlier empty lines & Comments

    self.navigationItem.rightBarButtonItem = self.addButtonItem;

}
- (IBAction) addButtonPressed: (id) sender {
    NSLog(@"Add button pressed!");

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用Instruments和NSZombie检测: http://www.markj.net/iphone-memory-debug-nszombie/