Forum: Ruby Re: IO not closed by GC

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
397f61cc4458e13157b4facf72325e5f?d=identicon&s=25 Gennady Bystritsky (Guest)
on 2006-04-17 22:09
(Received via mailing list)
Hi, Giles

I must relunctantly admit that I did not get your question. Are you
asking about GC in general or how GC.start operates in particular?
Assuming the latter, here's my rather naïve take on it.

Garbage collection is pretty complex facility that works deep inside a
VM or an interpreter, governed by its own rules and conditions. So from
where you call GC.start it may not even be possible at all to invoke all
needed machinery. Rather it is like saying to the VM/interprepter: start
garbage collection at you EARLIEST convenience, screw everything
regarding optimization and any other considerations. This "screw" part
is why it is usually a bad practice to causually intrude into GC realm,
as it may drastically affect the performance.

However, sometimes it may be good to have some communication path
between your script and GC. I remember using GC.start after some memory
intensive operations are ended when I kind of expect that it will be
quiet for some time, thus a good opportunity for GC to cleanup. Also, I
used it in some test cases in teardown().

Gennady.
Ce8b03e5750097942c58e12b46724312?d=identicon&s=25 Giles Bowkett (Guest)
on 2006-04-17 22:28
(Received via mailing list)
Hi Gennady, sorry, it was a bit wandering. What I mean is, why even
bother? The statement isn't actually guaranteed to do anything, and
even if it does do something, it usually isn't a good thing to do.
Usually, though, when I see something in a language and I can't see
the point, there's often some uber-hacker trick I've never encountered
that makes the thing staggeringly useful in a small number of special
cases.

Giles
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (Guest)
on 2006-04-18 18:59
(Received via mailing list)
2006/4/17, Giles Bowkett <gilesb@gmail.com>:
> Hi Gennady, sorry, it was a bit wandering. What I mean is, why even
> bother? The statement isn't actually guaranteed to do anything, and
> even if it does do something, it usually isn't a good thing to do.
> Usually, though, when I see something in a language and I can't see
> the point, there's often some uber-hacker trick I've never encountered
> that makes the thing staggeringly useful in a small number of special
> cases.

Honestly, to me it's even more unclear what you're after.  I suggest
you start over with a new thread formulating your question again. That
way you might also reach more people so your chances of getting a
proper answer are higher. :-)

Kind regards

robert
This topic is locked and can not be replied to.