FROM : Steve Bird
DATE : Tue Mar 25 17:34:43 2008
On Mar 25, 2008, at 12:26 PM, James Hober wrote:
>> When an application quits, it does _not_ properly release all of your
>> objects. Thus, their dealloc methods are generally not called. This
>> is a deliberate optimization since there's no point in manually
>> cleaning up the process memory. The kernel will completely eliminate
>> the process address space (and do other cleanup) when the process
>> exits.
>
> Do you write the dealloc anyway? Just wondering what others do.
> Personally I still write a dealloc method in a class for an object
> that I keep around for the life of the app. Then I preface it with
> a self-amusing comment:
>
> //actually this dealloc never gets called - the app just
> relinquishes all memory upon quitting.
> //But just to keep things tidy...
>
> I suppose this is utter superstition on my part. Yet somehow I
> feel better that there are matching releases, etc. that never get
> called.
>
> And of course, if the class were ever used not solely for a single
> object that lingers for the life of the app but for objects that
> come and go, then the proper memory management is in place.
>
> What do you do?
For the record, the Apple example programs have dealloc methods,
which of course never get called.
So when a (nameless) rookie puts a breakpoint on them, he might just
wonder why his breakpoints never hit.
----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175
DATE : Tue Mar 25 17:34:43 2008
On Mar 25, 2008, at 12:26 PM, James Hober wrote:
>> When an application quits, it does _not_ properly release all of your
>> objects. Thus, their dealloc methods are generally not called. This
>> is a deliberate optimization since there's no point in manually
>> cleaning up the process memory. The kernel will completely eliminate
>> the process address space (and do other cleanup) when the process
>> exits.
>
> Do you write the dealloc anyway? Just wondering what others do.
> Personally I still write a dealloc method in a class for an object
> that I keep around for the life of the app. Then I preface it with
> a self-amusing comment:
>
> //actually this dealloc never gets called - the app just
> relinquishes all memory upon quitting.
> //But just to keep things tidy...
>
> I suppose this is utter superstition on my part. Yet somehow I
> feel better that there are matching releases, etc. that never get
> called.
>
> And of course, if the class were ever used not solely for a single
> object that lingers for the life of the app but for objects that
> come and go, then the proper memory management is in place.
>
> What do you do?
For the record, the Apple example programs have dealloc methods,
which of course never get called.
So when a (nameless) rookie puts a breakpoint on them, he might just
wonder why his breakpoints never hit.
----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175
| Related mails | Author | Date |
|---|---|---|
| Samvel | Mar 24, 02:55 | |
| Sherm Pendley | Mar 24, 04:24 | |
| Samvel | Mar 24, 04:36 | |
| Sherm Pendley | Mar 24, 04:42 | |
| Ken Thomases | Mar 24, 21:12 | |
| James Hober | Mar 25, 17:26 | |
| Steve Bird | Mar 25, 17:34 | |
| j o a r | Mar 25, 17:44 | |
| James Hober | Mar 25, 23:19 | |
| j o a r | Mar 25, 23:26 |






Cocoa mail archive

