I would like to run a script indefinitely. It look likes my current script, as represented below, causes a memory leak. In addition I would like to retain the @time_value array since I need to cycle through the values for each new run.
class Data
def initialize
first_method
@time_value = [30, 60, 90]
end
def first_method
# get some data; takes about 1 hour
second_method
end
def second_method
#process the data
first_method
end
end
d = Data.new
Perpetual recursion may not only continue to consume memory but will eventually fail with a stack overflow. Change your indefinite processing to a simple loop.