Mega 2560 randomly hanging

If you have another device, like a Uno, I would try the same sketch on that. That would tend to rule out either the board, or the serial monitor interface. It's also possible the software on the USB interface processor is different.