Running out of memory is always expected when you program something. In strategy scripts, the two most frequent reasons for running out of memory are too many trades, and too many price ticks.