Displaying 1 result from an estimated 1 matches for "rem_var".
Did you mean:
get_var
2006 Sep 20
0
boy, that mongrel_upload_progress handler sucks!
..., I''m going to try and go back to
the hashes method.
I did some quick tests in the console like this:
class Leaker
def key
Time.now.to_i.to_s.split('''').sort_by { rand }.join
end
def inst_var
instance_variable_set("@key_#{key}", nil)
end
def rem_var
k = "@key_#{key}"
instance_variable_set(k, Time.now)
remove_instance_variable(k)
end
def hash
@hash ||= {}
k = key
@hash[k] = Time.now
@hash.delete k
end
end
l = Leaker.new
while 1; l.inst_var; end # eats memory!
while 1; l.rem_var; end # eats memory!...