Re: Releasing Objects

2009-12-24 Thread Greg Parker
On Dec 24, 2009, at 3:16 PM, Sherm Pendley wrote: > On Thu, Dec 24, 2009 at 5:13 PM, Greg Parker wrote: >> >> More precisely, there's exactly one short-circuit check and thus only one >> selector value. Under GC, @selector(retain) == @selector(release) == >> @selector(autorelease) == @selector(

Re: Releasing Objects

2009-12-24 Thread Sherm Pendley
On Thu, Dec 24, 2009 at 7:36 PM, Joar Wingfors wrote: > > On 24 dec 2009, at 15.16, Sherm Pendley wrote: > >> Just out of curiosity, is that really a short-circuit in the >> message-passing machinery, or are all those selectors simply >> registered to point to the same IMP function? A useless bit

Re: Releasing Objects

2009-12-24 Thread Joar Wingfors
On 24 dec 2009, at 15.16, Sherm Pendley wrote: > Just out of curiosity, is that really a short-circuit in the > message-passing machinery, or are all those selectors simply > registered to point to the same IMP function? A useless bit of > knowledge for us end-users, I know, but interesting just

Re: Releasing Objects

2009-12-24 Thread Sherm Pendley
On Thu, Dec 24, 2009 at 5:13 PM, Greg Parker wrote: > > More precisely, there's exactly one short-circuit check and thus only one > selector value. Under GC, @selector(retain) == @selector(release) == > @selector(autorelease) == @selector(dealloc) == @selector(retainCount). > Happily, `return s

Re: Releasing Objects

2009-12-24 Thread Greg Parker
On Dec 24, 2009, at 12:47 AM, Ken Thomases wrote: > On Dec 24, 2009, at 2:23 AM, John Engelhart wrote: >> >> Wait, what? I could understand that under GC -retain might be nothing more >> than the equivalent of "- (id)retain { return(self); }", but -retainCount? >> Is it really "- (NSUInteger)reta

Re: Releasing Objects

2009-12-24 Thread Ken Thomases
On Dec 24, 2009, at 2:23 AM, John Engelhart wrote: > On Wed, Dec 23, 2009 at 12:05 PM, Bill Bumgarner wrote: > >> On Dec 22, 2009, at 11:49 PM, Franck Zoccolo wrote: >> >>> You said that you're using garbage collection. When using GC retain and >>> release messages do nothing, and the retain co

Re: Releasing Objects

2009-12-24 Thread John Engelhart
On Wed, Dec 23, 2009 at 12:05 PM, Bill Bumgarner wrote: > > On Dec 22, 2009, at 11:49 PM, Franck Zoccolo wrote: > > > You said that you're using garbage collection. When using GC retain and > > release messages do nothing, and the retain count is not used to > > determine when an objet can be fre

Re: Releasing Objects

2009-12-23 Thread Michael Craig
Thanks! I've got a better grip on memory management now. By the way, I'm working with GC turned off, for the sake of learning this stuff. My bad for not including that. Michael S Craig > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > P

Re: Releasing Objects

2009-12-23 Thread Greg Guerin
Michael Craig wrote: If I'm missing some key concept here, just point me in the right direction and I'll go learn it. If it's something more specific, fill me in! In ownership terms, you released the object, so you no longer own it. References to it after that point are illegal, even if t

Re: Releasing Objects

2009-12-23 Thread mmalc Crawford
On Dec 22, 2009, at 9:40 pm, Michael Craig wrote: > At the point where the tutorial discusses garbage collection (end of ch. 5), > I decided to implement the deallocation of the Converter objects created by > ConverterController's convert: method. I want the deallocation to happen > inside conver

Re: Releasing Objects

2009-12-23 Thread Bill Bumgarner
On Dec 22, 2009, at 11:49 PM, Franck Zoccolo wrote: > You said that you're using garbage collection. When using GC retain and > release messages do nothing, and the retain count is not used to > determine when an objet can be freed from memory. If -retainCount is returning 1, then he can't be us

Re: Releasing Objects

2009-12-22 Thread Franck Zoccolo
On 23/12/2009 06:40, Michael Craig wrote: > Everything else is the same as is given in the tutorial. The console shows > that the reference count of converter is 1 both before and after the > release. Why ? > You said that you're using garbage collection. When using GC retain and release message

Re: Releasing Objects

2009-12-22 Thread Bill Bumgarner
On Dec 22, 2009, at 9:40 PM, Michael Craig wrote: >NSLog(@"Reference count: %lx", (unsigned long) [converter retainCount]); >[converter release]; >NSLog(@"Reference count: %lx", (unsigned long) [converter retainCount]); If the -release is going to deallocate converter, then the subse

Releasing Objects

2009-12-22 Thread Michael Craig
Hi folks, I'm new to Cocoa but I think I have a passable understanding of Obj-C. I'm learning Cocoa for a part of an undergraduate comp-sci independent project. I'm working through the Cocoa Application Tutorial, found here: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/

Releasing objects in Scripting Bridge

2009-03-13 Thread Reza Farhad
Exploring the example of sending emails using Scripting Bridge, I see that objects are allocated but not released: MailOutgoingMessage *emailMessage = [[[mail classForScriptingClass:@"outgoing message"] alloc] initWithProperties: [NSDictionary dictionaryWithObjectsAndKeys:@"test

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

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 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 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 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 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 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 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

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: Releasing objects causes BAD_ACCESS

2008-07-07 Thread Scott Ribe
> the connection object as well as the receivedData object are released > in the connectionDidFinishLoading delegate The sample also retains receivedData after creating the connection. Did you do that? And did you create the connection using alloc initxxx? -- Scott Ribe [EMAIL PROTECTED] http:/

Re: Releasing objects causes BAD_ACCESS

2008-07-07 Thread Randall Meadows
On Jul 7, 2008, at 3:49 PM, Randall Meadows wrote: NSZombieEnabled is a good start - http://developer.apple.com/technotes/tn2004/tn2124.html#SECFOUNDATION See also "Technical Note TN2124 - Mac OS X Debugging Magic": Heh, which now I s

Re: Releasing objects causes BAD_ACCESS

2008-07-07 Thread Randall Meadows
On Jul 7, 2008, at 3:44 PM, Jonathan del Strother wrote: On Mon, Jul 7, 2008 at 10:38 PM, Meik Schuetz <[EMAIL PROTECTED]> wrote: according to the document http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html the connection object as well

Re: Releasing objects causes BAD_ACCESS

2008-07-07 Thread Jonathan del Strother
On Mon, Jul 7, 2008 at 10:38 PM, Meik Schuetz <[EMAIL PROTECTED]> wrote: > Dear all, > > according to the document > > http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html > > the connection object as well as the receivedData object are released

Releasing objects causes BAD_ACCESS

2008-07-07 Thread Meik Schuetz
Dear all, according to the document http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html the connection object as well as the receivedData object are released in the connectionDidFinishLoading delegate. However, while debugging, I receiv