From: Sam Sungshik Kong Date: 2004-07-20T14:12:06+09:00 Subject: Re: GC with OLE Automation Hi! Thank you for replying. I didn't provide enough information. My ruby is 1.8 and also i386-mswin32. I narrowed down the problem. The problem occurs in irb mode only. If I exit the irb, the Excel process is ended. How about you? Sam "Shashank Date" wrote in message news:2m3jjeFigtndU1@uni-berlin.de... > Sam, > > "Sam Sungshik Kong" 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 > >