On Sat, Feb 6, 2016 at 10:48 AM, A Berger <aberger7890 / gmail.com> wrote:
> Hello
> Does anyone know a command to reset an irb-session to a clean state (like
> ending and restarting irb)? - on the mobile restarting it is not optimal.

What does "not optimal" mean?

> If not thats the purpose of GC.

The purpose of GC is to free memory of no longer referenced objects,
nothing else. I have no idea what you want to convey with that
sentence of yours.

> Can I free the master-object (main?) or do I have to get a tree of all
> objects and clear them.
> how can this be done with classes (=constants)? - Setting to nil is not the
> same as unsetting.

In terms of effects on GC of the formerly referenced object it is,
because you get rid of one reference.

> class A
> def x end
> end
> A=nil # still defined

> Is it done with freeing all classes+global vars?

I wouldn't worry about this: irb is a tool mostly used for interactive
sessions to test things. If you want a clean slate, exit and reenter.

Kind regards

robert

-- 
[guy, jim, charlie].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/

Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>