Memory out of range

Hello..
I need to store n number of objects in an array.

in this case i have array

x=[]

after every 10 second i want to add object for x

y={"step"=>10}

x.add(y)

but after around 20  minutes app crashed and show Memory out of range What can I do for fix that