Results 1 to 2 of 2
Discuss NSXMLParser issue? is it leaking? at the iPhone Developer Exchange - Hackint0sh.org; ...
  1. #1
    Newbie Array

    Join Date
    Feb 2008
    Posts
    5
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Question NSXMLParser issue? is it leaking?

    Hi,

    I've been trying to solve this for a long time, and maybe someone here can help me.

    I have an NSXMLParser that runs inside another thread. The thread is wrapped with:

    Code:
    -(void) BackgroundWork
    {
    NSAutoreleasePool	 *autoreleasepool = [[NSAutoreleasePool alloc] init];
    * my thread code which uses NSXMLParser
    [autoreleasepool release];
    }
    The NSXMLParser is something like this:

    Code:
    -(void)parseXMLFileAtURL:(NSString *)URL {
    	NSURL *xmlURL = [NSURL URLWithString:URL]; 
    	NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];
    	[xmlURL release];
    	
    	[xmlParser setDelegate:self];
    	[xmlParser setShouldProcessNamespaces:NO];
    	[xmlParser setShouldReportNamespacePrefixes:NO];
    	[xmlParser setShouldResolveExternalEntities:NO];
    	
    	errorOcurred = NO;
    	
    	[xmlParser parse];
    	[xmlParser release];	
    }
    Ok, here is the problem. This works 2 times, but always fails in the third time I try to do it. That's very odd to me, since I'm releasing the xmlParser object, which for some reasons seems to keep something in memory. If I remove the autoreleasepool it stops crashing, but starts leaking, since the thread will run in another context.

    It crashs in this line:

    Code:
    	NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL]; // init the parser
    From gdb:

    Program received signal: “EXC_BAD_ACCESS”.

    Code:
    0  0x94499688 in objc_msgSend ()
    #1  0x9541f5da in CFRelease ()
    #2  0x94e86557 in __CFHTTPMessageDeallocate ()
    #3  0x9541f788 in _CFRelease ()
    #4  0x94e870b6 in _CFURLRequestDeallocate ()
    #5  0x9541f788 in _CFRelease ()
    #6  0x94e89224 in __CFURLCacheNode::~__CFURLCacheNode ()
    #7  0x94ea7458 in __CFURLCache::RemoveResponseFromCacheContainers ()
    #8  0x94e9f4cc in __CFURLCache::AddResponseIntoCacheContainers ()
    #9  0x94ed5572 in __CFURLCache::CreateAndStoreCacheNode ()
    #10 0x94e8b067 in AddCacheTask ()
    #11 0x94e8aed5 in CFURLCacheAddCachedResponseForRequest ()
    #12 0x94e8816d in _CFURLConnectionSendCallbacks ()
    #13 0x94e87a25 in muxerSourcePerform ()
    #14 0x9541d615 in CFRunLoopRunSpecific ()
    #15 0x9541dcf8 in CFRunLoopRunInMode ()
    #16 0x94eab692 in CFURLConnectionSendSynchronousRequest ()
    #17 0x900ef60b in +[NSURLConnection sendSynchronousRequest:returningResponse:error:] ()
    #18 0x901c67f7 in -[NSURL resourceDataUsingCache:] ()
    #19 0x9009a49b in -[NSData(NSData) initWithContentsOfURL:] ()
    #20 0x9009a408 in +[NSData(NSData) dataWithContentsOfURL:] ()
    #21 0x901f3844 in -[NSXMLParser initWithContentsOfURL:] ()
    #22 0x00009162 in -[Parser parseXMLFileAtURL:] (self=0x46f3e0, _cmd=0xe8ca, URL=0x476870) at /Users/cusquinho/Desktop/MyApp/src/myapp/Classes/Parser.m:41
    #23 0x00009090 in -[Parser initWithModel::] (self=0x46f3e0, _cmd=0xcf94, myModel=0x456db0, myConfig=0xf420) at /Users/cusquinho/Desktop/TesteApp/src/myapp/Classes/Parser.m:24
    #24 0x00002c64 in -[testeAppDelegate BackgroundWork] (self=0x44e650, _cmd=0xd07a) at /Users/cusquinho/Desktop/TesteApp/src/testeApp/Classes/testeAppDelegate.m:118
    #25 0x9003bbad in -[NSThread main] ()
    #26 0x9003b754 in __NSThread__main__ ()
    #27 0x964376f5 in curveParamsArray ()
    #28 0x964375b2 in curveParamsArray ()
    (gdb)
    Any clue?

    Thanks!



  2. #2
    Newbie Array

    Join Date
    Mar 2009
    Posts
    1
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    I am experiencing the exact same crash but I am not using a separate thread of autoReleasePool for my NSXMLParser.

    Was there ever a resolution found to this?

    I do the parsing as part of the viewDidLoad method for one of my VeiwControllers and [xmlParser parse] returns success (YES) and the view loads but then crashes about 1 second later with the following stack:

    #0 0x9706d688 in objc_msgSend
    #1 0x9601de4f in NSPopAutoreleasePool
    #2 0x31dd26e8 in CATransactionCommit
    #3 0x966e89a2 in __CFRunLoopDoObservers
    #4 0x966ea404 in CFRunLoopRunSpecific
    #5 0x966eacd8 in CFRunLoopRunInMode
    #6 0x31566600 in GSEventRunModal
    #7 0x315666c5 in GSEventRun
    #8 0x30a4eca0 in -[UIApplication _run]
    #9 0x30a5a09c in UIApplicationMain
    #10 0x000025cc in main at main.m:14


    Thanks in advance for any help!

 

 

Similar Threads

  1. Replies: 0
    Last Post: 06-15-2011, 10:50 PM
  2. MacNN: Details of AMD's Radeon HD 7000M already leaking out
    By hackint0sh in forum Latest Headlines
    Replies: 0
    Last Post: 01-03-2011, 09:40 PM
  3. Replies: 0
    Last Post: 08-14-2010, 07:40 PM
  4. Slashdot: Safari Privacy Bug May Be Leaking Your Data
    By hackint0sh in forum Latest Headlines
    Replies: 0
    Last Post: 07-26-2010, 09:40 AM
  5. Slashdot: Safari Privacy Bug May Be Leaking Your Data
    By hackint0sh in forum Latest Headlines
    Replies: 0
    Last Post: 07-23-2010, 12:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 04:19 PM.
twitter, follow us!