K
Ken Awamura
Suppose I create a new object:
p = new Object
How can I kill/destroy this object forever?
p = new Object
How can I kill/destroy this object forever?
Ken said:Suppose I create a new object:
p = new Object
How can I kill/destroy this object forever?
Tim said:First, it's
p = Object.new
Second, you can't. Ruby automatically cleans up an object when there is
no more references to it.
Ken said:Does ruby's garbage collector really work, or it's as lame as .NET
garbage collector?
It really works.
It really works.
tekwiz said:That's not entirely correct. The newest .NET GC uses an algorithm
that is actually more efficient than the inefficient Mark and Sweep GC
algorithm that Ruby uses. However, Ruby's GC is much less buggy
than .NET's in my experience.
Sam said:Eh... I'm less a fan of Ruby's GC. As a former c# developer, I'm
actually curious why the comment on .NET's GC?
viewstate (another bad idea imho) ... maintenance and migrations will bedevelopers will have to re-learn asp.net, forget page self-postbacks,
BTW, objects in Ruby are not guaranteed to be GC'ed when there are no
more references to them. They can easily survive numerous cycles of
the GC and be found in the ObjectSpace. It's actually really
frustrating.
That's conservative GC for ya... *shrug* It has never been much of an
issue for me, but I can see where it can really hose you up.
It's a general feature of most GC algorithms, not just conservative*
ones.
This delayed action of most GCs is one reason why it's a BAD idea to
use finalization to implement application logic. [...]
It isn't a (usually) failure of GC algorithms, it is (usually) a
failure of GC implementations.
My GC didn't have this problem.![]()
Neither does .NET's GC IIRC. Which is why the posts interested me.![]()
So both of these GC implementations return the space used by every
object at the instance the last reference to that object is lost?
That wasn't what I was claiming of the GC I wrote, nor is that an
attribute of conservative GCs (or any GC I know of). Instantaneous
collection wasn't a part of this thread at all. The complaint (from
Sam), as I interpreted it, was that conservative GCs sometimes NEVER
collect an object (which is what makes them conservative), and that is
all I was addressing.
Suppose I create a new object:
p =3D new Object
How can I kill/destroy this object forever?
Daniel said:Take off and nuke it from orbit. It's the only way to be sure.
Regards,
Dan
Take off and nuke it from orbit. It's the only way to be sure.
Regards,
Dan
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.