4 ms·
Everything GC can do, ARC can do in strict space and time constraints.
by bitwize 12y ago
Everything GC can do, ARC can do in strict space and time constraints.
- danbruc 12y agoPlain (automatic) reference counting can not handle cycles without support from developers.
- blub 12y agoI find that a good thing, because developers are trained to think that they have to use weak references and think about object lifetimes. Android developers tend to not think so much about lifetimes which leads to memory leaks because Dalvik apparently can't figure out some of those cycles by itself. Just do a search for "Android memory leak" to see some examples.
- smrtinsert 12y agoA platform with 80% of mobile installations has developers who don't understand object lifecycles Got it.
- kasabali 12y agoI guess he meant Android application developers, not the people who wrote Dalvik.
- tomjen3 12y agoTry to parse any tree structure without creating cycles (say the XML/XHTML inside an ebook) - that may be possibly with just one or two devs on the project but as soon as every dev doesn't know every line of code there is an oppertunity for errors and you only need one link to leak memory. That Dalvik can't handle the cycles is stupid but an issue with Dalvik (that is likely to be phased out with the new runtime) not an issue with GC. Computers are really, really, good about executing trivial tasks repeatedly without ever making a stupid mistake, humans not so. And as Terminator taught us: never send a human to do a machines job.
- danbruc 12y agoAnd time constraints are also more of an illusion than real - unless your program has no input from the outside world you can not really know when a reference count will drop to zero and triggers a deallocation. Every time a reference goes away may be the time an (unexpected) deallocation happens.
- chrisseaton 12y agoCan ARC move objects to compact the heap?