yeah, I would guess that you had some sort of array overflow. It is a bad idea to add to an array every single frame. What you could do instead is have it add to the array only if the player is far enough away from the most recent point.