What Xamarin.iOS does about memory management? With usual IL we have Garbage Collector which takes care of objects not in use and reliefs programmer from calling delete. How this works when Xamarin compiles code to native? Who cleans objects which aren't used anymore?
This question answers how compilation works but doesn't explain the memory management part: How MonoTouch works?
Xamarin. Android applications compile from C# into Intermediate Language (IL) which is then Just-in-Time (JIT) compiled to a native assembly when the application launches. Xamarin. Android applications run within the Mono execution environment, side by side with the Android Runtime (ART) virtual machine.
Xamarin is an open source app platform from Microsoft for building modern & performant iOS and Android apps with C# and . NET.
Xamarin Forms enable fast prototyping with built-in UI libraries, adapted both to Android and iOS; Rich access to native APIs – just like in native apps, you can get access to the user's Bluetooth, camera, microphone. Features that use these API can be written in a specific language for faster performance.
Xamarin allows developers to develop native applications for Android, iOS and Windows Phone platforms, with a single codebase, i.e. C# and a single IDE, i.e. Visual Studio . Thus, a developer can be able to develop native mobile applications without knowing Java, Kotlin, Objective-C or Swift.
The answer you seek was given on the question you linked.
To summarize, the IL-to-native translation process is done ahead of time, but other pieces of the Mono runtime are still required. JIT compilation is only one of the tasks performed by the runtime, and this particular piece is incompatible with iOS' memory restrictions (writable memory pages cannot also be executable, and this is required for a JIT to function). This is, AFAIK, the only reason why ahead-of-time (AOT) compilation is required at all.
The Mono garbage collector does indeed run on iOS, it's just embedded into the binary produced by the Monotouch compiler. The produced binary contains your AOT-compiled application code as well as AOT-compiled versions of the libraries you use, and a slimmed-down version of the Mono runtime.
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