• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why does releasing this array cause a crash?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why does releasing this array cause a crash?


  • Subject: Why does releasing this array cause a crash?
  • From: James Cicenia <email@hidden>
  • Date: Tue, 10 Mar 2009 17:35:30 -0500

Hello

I am confused on this one:

In my method I have a local array:

NSMutableArray *arraySubType = [[NSMutableArray alloc]init];


Then in a loop from the database I have:

while (sqlite3_step(statement) == SQLITE_ROW) {

if(![aDict objectForKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]){
NSMutableArray *tmpArray = [[NSMutableArray alloc]init];
[aDict setValue:tmpArray forKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]];
[tmpArray release];
}
arraySubType = [aDict objectForKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]];
[arraySubType addObject: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)]]
[aDict setValue:arraySubType forKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]];

}


Shouldn't I now release arraySubType ??

If I do, later on I get a crash, if I don't I get no crash.

Thanks
James Cicenia

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Why does releasing this array cause a crash?
      • From: Randall Meadows <email@hidden>
  • Prev by Date: Re: Background Process?
  • Next by Date: Re: Why does releasing this array cause a crash?
  • Previous by thread: Fwd: Background Process?
  • Next by thread: Re: Why does releasing this array cause a crash?
  • Index(es):
    • Date
    • Thread