If not, are there any plans to add Garbage Collection to the iPhone?
Related question: This question from January (pre OS 3.0) says the iPhone had no GC at the time.
Thanks!
iOS has no method of Garbage Collection. Even so, Garbage Collection is entirely unnecessary (for all practical purposes) when ARC is used. ARC works its magic at compile time to do the reference counting for you thereby making it unnecessary (and actually non-allowed) to use any other sort of memory management.
It works in a way such that the runtime detects unused objects and object graphs in the background. This happens at intermediate intervals, either after a certain amount of time has passed or when the runtime memory gets low, and not released at that exact moment.
Real-time garbage collection as outlined in the paper below is able to garbage collect unused memory with a fixed, short (milliseconds) bound on the amount of time the program is interrupted at any one time, and the percentage of time the program is interrupted in aggregate by the garbage collector.
iPhone OS 3.0 does not have any garbage collection features and Apple has not indicated they will include this feature in future OS releases (they tend to be secretive about future features). You still need to manage memory manually through alloc
, release
and autorelease
calls.
No it does not. There are no announced plans to add that I'm aware off.
One suspects that, at least part of the reason is because of concerns on Apple's part about performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With