I was running that on an iPad 3.

I have just restarted my iPad (to free up memory) but it still crashed when I ran it. I checked sys.getrecursionlimit() and it gives me 256, so not excessively high...