3 ms·
Even though ARC made memory management much easier for Objective-C developers, when using RubyMotion you don’t have to worry about memory (well at least not exp
by chrisdevereux 14y ago
Even though ARC made memory management much easier for Objective-C developers, when using RubyMotion you don’t have to worry about memory (well at least not explicitly, don’t be dumb and create a bazillion objects and hold references to them either)
I'm not convinced about this. Here's a quote from the rubymotion runtime guide:
RubyMotion’s memory management system is designed to simplify the development process. Unlike traditional Objective-C programming, object references are automatically created and destroyed by the system. It is very similar to Objective-C’s ARC, in design, but it is differently implemented.
Object cycles, when two or more objects refer to each other, are currently not handled by the runtime, but will be in future releases.
There are a lot of things that look really cool about RubyMotion, but it doesn't seem to me that memory management is massively different to the situation in Objective-C with ARC on, or indeed C++ with smart pointers.
They haven't said how weak references are going to be handled, but it seems like the programmer will have to specify that a reference should be weak. In that case, the difficult part of memory management in a non-gc langage --- making sure you avoid either reference cycles, or inadvertently deallocating objects --- is still there in rubymotion.
(disclaimer: I haven't used rubymotion -- I'm just going on what's been published about it)