Two minutes later the same people turn back to their Cocoa apps
which greets them with the automatic wait cursor because its been
busy with emptying the event loop autorelease pool for the past
minute ;)
In all the times I've spent using Shark to optimize a variety of
applications, _none_ of the retain/release/auto-release/dealloc
memory manage routines have ever been anywhere in performance
critical sections. Feel free to sample any Cocoa app and see if
you can find one where using the manual reference counting routines
are a performance problem...
I've seen that happen a LOT of times. If you have a sufficiently
large number of objects, these things can really add up.
I've recently thought of doing an optimization to speed up exactly
this. I have an array of objects that the user can filter. I add the
objects that matches the filter to a second array. I've noted that
when I destroy this second array (when the user removes the filter),
our app hangs for a long, long, time while sending release to these
objects. Strictly speaking the objects doesn't need to be retained at
all in the second array, as they're own3d by the first array. If I
just replace the NSArray with a CFArray I can remove this problem,
without having to touch any other code. Silly example, but I just
wanted to point out that it does happen, and how.
That said, I'm always amazed how much discussion that goes into the
topic of memory management in Cocoa / ObjC. My opinion is that the
current scheme works really well, and that someone who works with
Cocoa / ObjC for a living quickly stops thinking about memory
management, because once you learn the basic rules and patterns, it
just works. I don't claim that we never spend time tracking down
memory related bugs / performance problems in our applications, but I
do think that they are a pretty small part of what we have to do.
I like the fact that ObjC is a very thin wrapper around C, it's a
very pragmatic approach that works really well. I really like
reference counting, because it seems to strike a nice balance between
automation on one hand, and programmer control on the other. I'm a
bit sceptic to the idea of adding GC to Cocoa / ObjC, but that's
probably because I don't know enough about it. Perhaps it can be done
in an efficient and reasonably non-disruptive way. Dietmar seems to
think so, and he certainly seems to know a lot about GC.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden