Active record is not releaed used memory

I have tried small ruby program like

require ‘rubygems’
require ‘postgres’
db = PGconn.connect(‘localhost’, 5432, ‘’, ‘’, ‘prdjnj’,‘postgres’,
‘postgres’)
res=db.exec(“select * from users limit 300000”)
res.clear
puts “After clear result object”
a=1
while a!=2
end

Before running this program,Initial free memory is 640MB
The query(“select * from users limit 300000”) execution taken the time
is upto 110MB when i run this program … So free memory is reduced from
640MB to 530MB…Now used memory is 110MB that released after the
execution of the query ie program reached the while conditions

I have followed same scenario in Rail’s active_record instead of
PGconn…

@users=User.all(:limit=>300000)
@users.clear
puts “After clear result object”

Here Used memory is not released even after execute the query and clear
resulting object…Memory is released well when i use PGconn… but its
not working in active_record

Please instruct me how to release used memory in Rail’s active_record