[MacRuby-devel] Garbage Collector in MacRuby

Daniel Lopes danielvlopes at gmail.com
Sat Apr 10 21:23:52 PDT 2010


Thanks to answer Laurent.

On Sat, Apr 10, 2010 at 9:47 PM, Laurent Sansonetti
<lsansonetti at apple.com>wrote:

> Hi Daniel,
>
> MacRuby uses the Objective-C garbage collector, and also runs the
> Objective-C runtime in GC mode. It basically means that you can use Cocoa
> objects without the need to retain/release them, and they will be
> automatically collected at runtime once there is no reference to them
> anymore. This is also true for pure Ruby code.
>
> Please note that the collector is not deterministic and runs on its own
> thread(s) (and also collects memory from there). So, setting variables to
> nil or calling GC.start can help but there is no guarantee that the objects
> will be immediately freed.
>
> In general you should not care about these issues. Just don't think about
> managing memory and it should work fine. If you find a problematic case, let
> us know :-)
>
> Laurent
>
> On Apr 10, 2010, at 8:44 AM, Daniel Lopes wrote:
>
> > Hello, I would like to know more about the garbage collector. In Obj-c
> even when we have GC enabled we should set nil to the vars (which sometimes
> is also useful in pure ruby). Correct me if I'm wrong but in MacRuby we
> can't use GDB, right? We still able to use profile tools? I should set all
> vars to nil or it will be treated like normal ruby code and I need set to
> nil only the objects that I want to be released now?
> >
> > Thanks.
> > _______________________________________________
> > MacRuby-devel mailing list
> > MacRuby-devel at lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100411/df62488c/attachment.html>


More information about the MacRuby-devel mailing list