<p><a href="http://www.ruby-lang.org" rel="noreferrer">Ruby</a> is truly memory-hungry - but also worth every single bit. </p>

<p>What do you do to keep the memory usage low? Do you avoid big strings and use smaller arrays/hashes instead or is it no problem to concern about for you and let the garbage collector do the job?</p>

<p><strong>Edit</strong>: I found a nice article about this topic <a href="http://gnomecoder.wordpress.com/2007/10/02/rubys-garbage-collection-problem/" rel="noreferrer">here</a> - old but still interesting.</p>

I am not a ruby developer but I think some techniques and methods are true of any language:
Use the minimum size variable suitable for the job
Destroy and close variables and connections when not in use
However if you have an object you will need to use many times consider keeping it in scope
Any loops with manipulations of a big string dp the work on a smaller string and then append to bigger string
Use decent (try catch finally) error handling to make sure objects and connections are closed
When dealing with data sets only return the minimum necessary