I just compiled your code on my Mega. It has 8K SRAM. With minimal code (the test I posted), it shows 7459 bytes free. With your code, it shows 5747 bytes free. That would be using more SRAM than your device has.
I just compiled your code on my Mega. It has 8K SRAM. With minimal code (the test I posted), it shows 7459 bytes free. With your code, it shows 5747 bytes free. That would be using more SRAM than your device has.