Topic: memory is not release

Hi all,

   In my application, i have Memory leak problem ie used memory for query execution is not released after executing the query.i have already posted my problem
http://railsforum.com/viewtopic.php?id=38882
http://railsforum.com/viewtopic.php?id=38299

Later temporarily found solution that memory is released
when i use AR.connection.execute instead of ActiveRecord as follow

      @result = OfftakeReportingTable.connection.execute("select * from offtake_reporting_tables limit 100000")
      @result.close

Here used memory is released. No problem
but memory is not released if i copied record to another variable like

@result = OfftakeReportingTable.connection.execute("select * from offtake_reporting_tables limit 100000")
      z=[]
      for a in @result
    z << a
      end
      @result.close
      z.clear

Guide me to solve this problem.

Note:
         I used to track free memory and used memory by 'free -m' command