Re: Non-NSObject object and garbage collection

2008-08-13 Thread Ken Ferry
On Tue, Aug 12, 2008 at 11:30 PM, Quincey Morris <[EMAIL PROTECTED]> wrote: > On Aug 12, 2008, at 22:52, Ken Ferry wrote: > >> In general, you don't need to CFRetain an object to keep it alive >> while it's on the stack. The fact that it's on the stack is enough. >> If this wasn't true, there'd be

Re: Non-NSObject object and garbage collection

2008-08-12 Thread Quincey Morris
On Aug 12, 2008, at 22:52, Ken Ferry wrote: In general, you don't need to CFRetain an object to keep it alive while it's on the stack. The fact that it's on the stack is enough. If this wasn't true, there'd be a race, since the collector might destroy the object before you retained it. Unless

Re: Non-NSObject object and garbage collection

2008-08-12 Thread Ken Ferry
On Tue, Aug 12, 2008 at 10:32 PM, Quincey Morris <[EMAIL PROTECTED]> wrote: > On Aug 12, 2008, at 21:22, Oleg Krupnov wrote: > >> Actually, I don't know how to "break on something". Would you please >> tell me? > > Open the Breakpoints window (Run | Show | Breakpoints). Double click where > it says

Re: Non-NSObject object and garbage collection

2008-08-12 Thread Ken Ferry
Hm. This is not going to be a great introduction to Mac OS X programming. :-) It turns out that CGPDFContentStream, CGPDFOperatorTable, and CGPDFScanner are not CFTypes. You cannot use any function intended for CFTypes with them, including CFRetain, CFRelease and CFMakeCollectable. You cannot p

Re: Non-NSObject object and garbage collection

2008-08-12 Thread Quincey Morris
On Aug 12, 2008, at 21:22, Oleg Krupnov wrote: Actually, I don't know how to "break on something". Would you please tell me? Open the Breakpoints window (Run | Show | Breakpoints). Double click where it says "Double-click for symbol" and type the symbol name you want to break on (auto_refc

Re: Non-NSObject object and garbage collection

2008-08-12 Thread Oleg Krupnov
On Wed, Aug 13, 2008 at 6:56 AM, Ken Ferry <[EMAIL PROTECTED]> wrote: > What does the stack look like when you break on > auto_refcount_underflow_error? After you break, you can do "call > (void)CFShow()" with the number printed out in the > log message. That should hopefully give you the type of

Re: Non-NSObject object and garbage collection

2008-08-12 Thread Ken Ferry
What does the stack look like when you break on auto_refcount_underflow_error? After you break, you can do "call (void)CFShow()" with the number printed out in the log message. That should hopefully give you the type of the object, which might help you determine where the issue is. What do you m

Re: Non-NSObject object and garbage collection

2008-08-12 Thread Oleg Krupnov
I have added a call to CFMakeCollectable each time after I create a CF object like this CFSomeTypeRef a = CFCreateSomeType(); if (a != nil) { CFMakeCollectable(a); } But I keep getting this runtime message in the console: malloc: reference count underflow for 0x10773c0, break on auto_refcount

Re: Non-NSObject object and garbage collection

2008-08-11 Thread Jean-Daniel Dupas
Le 11 août 08 à 14:25, Antonio Nunes a écrit : On 11 Aug 2008, at 13:14, Antonio Nunes wrote: Will it cause a memory leak if I treat the Quartz object in the same way as I do to all my NSObject descendants, i.e. no retains and rely only on garbage collection? You either take care of the obj

Re: Non-NSObject object and garbage collection

2008-08-11 Thread Antonio Nunes
On 11 Aug 2008, at 13:14, Antonio Nunes wrote: Will it cause a memory leak if I treat the Quartz object in the same way as I do to all my NSObject descendants, i.e. no retains and rely only on garbage collection? You either take care of the object's life time manually as you would in a non-g

Re: Non-NSObject object and garbage collection

2008-08-11 Thread Antonio Nunes
On 11 Aug 2008, at 12:56, Oleg Krupnov wrote: Will it cause a memory leak if I treat the Quartz object in the same way as I do to all my NSObject descendants, i.e. no retains and rely only on garbage collection? You either take care of the object's life time manually as you would in a non-ga