Adding garbage collection to iPhone?

MonoTouch has automatic garbage collection on the iPhone. Could someone prematurely implement garbage collection for Objective-C on iOS? I am not a guy to do this, but I am curious why or is it impossible.

I know there are projects like this : what do I need to use them in iOS? Since they are still in C / C ++, and Objective-C contains these languages ​​as subsets, but nevertheless, these languages ​​really know about system architecture ... I’m from the bottom here ...

While we are here, if anyone knows of any attempts to implement GC on iOS, links would be useful ...

+3
source share
2 answers

I do not think that's possible. The problem is that Objective-C is also used inside the system library. In OS X, where the Objective-C garbage collector is supported, there are three modes when compiling code:

  • A compiled function can only be called from an environment other than GC.
  • A compiled function can only be called from within the GC environment.
  • A compiled function can be called both from the GC environment and from a non-GC environment.

See discussion here . The fact is that the system library must be in the third mode so that the OS supports both non-GC and GC-applications. And in OS X, libraries come into this hybrid mode. In iOS, I assume it comes in mode 1. (I don’t know for sure, because my phone wasn’t hacked.)

, , , , , .

, GC iOS.

+7

. , . , .

:

iPhone?

+1

Source: https://habr.com/ru/post/1765133/


All Articles