confused about allocating and releasing objects

2008-08-27 Thread Memo Akten
HI All, i'm a bit confused about the 2 scenarios: NSDictionary *myData1 = [NSDictionary dictionaryWithContentsOfFile:@"mydata.plist"]; // this one I don't need to release when I'm done? NSDictionary *myData2 = [[NSDictionary alloc] initWithContentsOfFile:@"mydata.plist"]; // this one I do

Re: confused about allocating and releasing objects

2008-08-27 Thread Jonathan del Strother
On Wed, Aug 27, 2008 at 11:45 AM, Memo Akten <[EMAIL PROTECTED]> wrote: > HI All, i'm a bit confused about the 2 scenarios: > > NSDictionary *myData1 = [NSDictionary > dictionaryWithContentsOfFile:@"mydata.plist"]; // this one I don't > need to release when I'm done? > NSDictionary *myData

Re: confused about allocating and releasing objects

2008-08-27 Thread Memo Akten
ok thanks, I"ve added that link to my ever growing Cocoa bookmarks!! I'm just writing a Quartz Composer plugin using the QCPlugIn API and ran into a problem regarding this, my question isn't related to the QCPlugIn API so I'm posting here first. At the start of the plugin (in enableExecutio

Re: confused about allocating and releasing objects

2008-08-27 Thread Graham Cox
On 27 Aug 2008, at 9:13 pm, Memo Akten wrote: At the start of the plugin (in enableExecution) I use the code: - (void) loadCardXMLData { NSString *dataPath = @"/data.plist"; cardsLoadedData = [NSDictionary dictionaryWithContentsOfFile: dataPath]; // cardsLoadedData = [[NSDictionary

Re: confused about allocating and releasing objects

2008-08-27 Thread Jonathan del Strother
On Wed, Aug 27, 2008 at 12:13 PM, Memo Akten <[EMAIL PROTECTED]> wrote: > ok thanks, I"ve added that link to my ever growing Cocoa bookmarks!! > I'm just writing a Quartz Composer plugin using the QCPlugIn API and ran > into a problem regarding this, my question isn't related to the QCPlugIn API >

Re: confused about allocating and releasing objects

2008-08-27 Thread Memo Akten
Thanks guys, its starting to become a bit clearer now. I'll use the alloc / init / release route for now until I"ve read through the memory management doc Cheers, Memo. On 27 Aug 2008, at 12:22, Jonathan del Strother wrote: On Wed, Aug 27, 2008 at 12:13 PM, Memo Akten <[EMAIL PROTECTED]>

Re: confused about allocating and releasing objects

2008-08-27 Thread Devon Ferns
If you had access to the NSDictionary source code you'd find that the NSDictionary's +dictionaryWithContentsOfFile:(NSString*)fileName would probably look something like this: +(NSDictionary*) dictionaryWithContentsOfFile:(NSString*)fileName { return [[[NSDictionary alloc] initWithConte

Re: confused about allocating and releasing objects

2008-08-27 Thread Sherm Pendley
On Wed, Aug 27, 2008 at 7:22 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > > Just thinking aloud, but I wonder if the plug-in is being executed outside > of the app's autorelease pool stack? The freeze could be because autorelease > is being called but there's no pool available. In general, that doe

Re: confused about allocating and releasing objects

2008-08-27 Thread mmalc crawford
On Aug 27, 2008, at 3:57 AM, Jonathan del Strother wrote: Whats the difference between the two methods? (I know the second one creates a blank dictionary first, and then loads the file - but I mean which one is better for what purpose? - why would I choose one over the other). Use whichev