memory management in long running scripts


I have a script that runs for a long time, and seems to use up a large
chunk of memory, building up fairly quickly, but then never really
going above 55% of the system memory. This is the basic structure of
my script:

loop do
  Find.find(path) do |name|
    if name
      Find.prune unless name.eql? path

Even when my do_something_with_file function is modified to simply
return right away, the memory usage of the script continues to
increase. Is there any issue with reading directories as I am above?
Or is there a way to cap the amount of memory a script uses, or a way
to force garbage collection?