From: Eleanor McHugh Date: 2009-03-17T21:28:42+09:00 Subject: Re: free RAM problem On 17 Mar 2009, at 12:10, Edouard Dantes wrote: > Hi, > > I am doing some text processing. > > I clean every variable after each loop and use the > GC.start > ObjectSpace.garbage_collect > after each loop too. > > So I have three variables whose cumulative size always remain inferior > to 100'000 utf8 characters. > > Nevertheless my free RAM is falling with run-time length like if each > time loaded is added to the RAM. > > How can I force the RAM to clean completely from no-used stuff? Without seeing code it's hard to comment, but two things which spring instantly to mind: 1. are you sure your input data is no longer being referenced elsewhere in the program as live objects are not garbage collected; 2. are you generating symbols as part of processing the input data as these are not garbage collected (at least not in Ruby 1.8). Also in general if you have enough memory, don't force garbage collection: the Ruby runtime does this perfectly well and the overall performance of your program will improve. 300k of utf8 is such a trivial amount of memory consumption... Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason