Re: IO not closed by GC


#1

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.


#2

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


#3

2006/4/17, Giles B. removed_email_address@domain.invalid:

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. :slight_smile:

Kind regards

robert