Sam,

"Sam Sungshik Kong" <ssk / chol.nospam.net> wrote in message

> I access MS Excel using OLE Automation with Ruby.
> The problem is that after quitting it, Excel process is still in the
memory.

Which version of Ruby are you having ?

> When I did the same thing with Python, it was released.
> Is it related to the GC behavior?
> (Python uses reference counting method and Ruby uses Mark and Sweep.)
>
> Here's my code:
>
> def get_excel(fn = "", visible = true)
>     require 'win32ole'
>     excel = WIN32OLE.new("Excel.application")
>     excel.visible = visible
>     if fn != ""
>         excel.Workbooks.Open(fn)
>     end
>     return excel
> end
>
> xl = get_excel
> ...#handles xl
> xl.quit #Excel disappears from the screen.
> xl = nil #In Python, this GCed Excel completely.
> GC.start #Excel seems to go away but the process is still alive when I
watch
> Task Manager.
>
> Did I do something wrong?

Not that I can see. When I ran this on my machine (Win XP Home, Excel 2002)
using ruby 1.8.2 (2004-06-29) [i386-mswin32] it did as expected. Even
* without * the xl = nil; GC.start

> Thanks.
>
> Sam


HTH,
-- shanko