From: Ari Brown Date: 2007-07-17T07:28:59+09:00 Subject: Re: How to reclaim memory without GC.start On Jul 16, 2007, at 5:30 PM, dtuttle1@gmail.com wrote: > Hi - I have a memory and cpu-constrained embedded app. There's a long- > running loop with a local object (buffer) which eats up memory. A > GC.start on every iteration will reclaim it, but that eats the cpu. > > Is there a way to deallocate the memory used by the temporary objects? > > file = File.new file_path > while buffer = file.read(512) > stream_host_connection.write buffer > stream_host_connection.flush > # GC.start - too expensive > end Unfortunately, I don't know how to do it. If I did, I would include it in every single one of my programs. But you should have an extra '=' after buffer. It should read... ... while buffer == file.read(512) ... Note the double '='. G'luck, and PLEASE pop an email to the list if you figure out how to accomplish it. -------------------------------------------| Nietzsche is my copilot