From: Hidenori Hashizume Date: 2007-05-21T20:31:41+09:00 Subject: [ruby-list:43553] win32oleプログラミングでのメモリリーク はしづめです。 win32oleを用いた常駐プログラムを作成していますが、メモリリークが発生して いるらしくメモリの使用量が増加して行きます。 どなたか原因と対策をご教授願えませんでしょうか? 下のプログラムはメモリリークが発生する例です。 機能として、稼動しているInternet ExplorerのURLを0.1秒おきに出力します。 ■例 require "win32ole" def ie_each shell = WIN32OLE.new("Shell.Application") begin shell.Windows.each do |w| if w.document.ole_obj_help.name == 'DispHTMLDocument' yield(w) else #nop end end rescue WIN32OLERuntimeError=>evar p evar rescue NoMethodError=>evar p evar exit end end def main while 1 ie_each{|ie| if ie.busy #skip else p ie.locationURL end sleep(0.1) } end end main