None of them.

According to the memory management rules, you're only responsible for objects 
you create via an "alloc", "new", or "copy" method, which none of these are.  
All of these objects are autoreleased.

Dave

On Jan 19, 2010, at 1:50 PM, Philip Vallone wrote:

> 
> I am I trying to learn proper memory management and have question: In the 
> following example, which objects am I responsible to release?
> 
> 
> - (void) viewDidLoad{
> 
>       NSString *tempStr = nil;
>       NSString *filepath = [[NSBundle mainBundle] pathForResource:@"filename" 
> ofType:@"xml"];
>       
>       NSData *xmlData = [NSData dataWithContentsOfFile:filepath];
>       
>       NSMutableString *xqueryStr = [NSMutableString 
> stringWithFormat:@"/data/title/@number"];
>       
>       NSArray *resultNodes = PerformXMLXPathQuery(xmlData, xqueryStr);        
>       
>       NSEnumerator *e = [resultNodes objectEnumerator];
>       
>       id object;
>       
>       while (object = [e nextObject]) {
>               
>               for (NSString *key in object){
>                       
>                       tempStr = [[object objectForKey:key] 
> stringByTrimmingCharactersInSet:[NSCharacterSet 
> whitespaceAndNewlineCharacterSet]];
>                       
>                       if ([tempStr isEqualToString:@"number"] ) {
>                               
>                       }else {
>                       
>                                       // do something here
>                               
>                       }
>               }
>               
>       }
> 
> }
> 
> Thanks,
> 
> Phil
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
> 
> This email sent to davedel...@me.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to