From: Chuck Remes Date: 2010-01-16T01:59:55+09:00 Subject: Re: WIN32OLE memory leaks On Jan 15, 2010, at 8:44 AM, Masaki Suketa wrote: > Hello, > > On Thu, Jan 14, 2010 at 12:55:02AM +0900, Chuck Remes wrote: > >>>> Does anyone have any suggestions on how to force these unused >>>> objects >>>> to get GC'ed? This program needs to run a long time so a memory >>>> leak >>>> is absolutely fatal. > > (snip) > >> I have a method that makes a function call on the COM object >> (#request_data). When the function has data to return, it generates a >> "DataResolved" event which triggers my callback which was registered >> once at the beginning of execution. The callback calls #save and >> loops >> through the collection and pulls some properties into a hash which >> then >> gets inserted into mongodb. When the collection is exhausted, I go >> back >> to #request_data and make another call on the COM object to request >> the >> next batch. > > How about calling GC.start before requesting the next batch? > # If you had used GC.start already, ignore this suggestion. Calling GC.start does not fix the problem. The program continues to leak memory and run out. cr