Code stops after some time using delay

huh? neither delay() nor millis() consume memory.

are you powering the servos thru the Arduino, which might cause noise on the supply that could affect the Arduino?