2010/7/5 Thierry Lambert <thyresias / gmail.com>:
> Robert Klemme wrote:
>> There is no guarantee for GC. =A0For efficiency reasons most GC
>> implementations do not simply delete all objects once there is no life
>> reference to them any more. =A0Even if you explicitly start a collection
>> there is no guarantee.
> Thanks Robert, I kind of had this reservation in the back of my head, so
> I'm more looking for a workaround: in real life, the Inner object would
> be an application started through OLE automation, for instance Excel,
> Word, Access... The problem is that the application won't close after
> sending it a Quit: it will close after being garbage-collected. Any idea
> how I can control the fact that WIN32OLE objects are actually freed?
> (ole_free does not work well, and I won't complain since the doc says we
> should not use it...)

There is generally no way to control when an object will be collected
unless you start hacking the interpreter.  For proper resource
deallocation you usually use begin - ensure, but this can only work by
invoking methods not forcing destruction of objects.  See also

http://blog.rubybestpractices.com/posts/rklemme/002_Writing_Block_Methods.h=
tml

I don't know WIN32OLE so I can't tell whether there is another trick
that helps, sorry.

Kind regards

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/