Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does iPhone OS 3.0 have a real garbage collector?

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!

like image 482
Tim Stewart Avatar asked Jun 30 '09 14:06

Tim Stewart


People also ask

Does iOS have a garbage collector?

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.

What is garbage collection iOS?

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.

What is real time garbage collection?

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.


2 Answers

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.

like image 103
zpesk Avatar answered Nov 11 '22 00:11

zpesk


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.

like image 22
Dan Bennett Avatar answered Nov 11 '22 01:11

Dan Bennett