My sketch freeze

It may help, or it may just delay the inevitable.
Without having your exact environment and code, it is difficult to say what will happen
Does the amount of free RAM remain relatively constant over time?

int unsigned long lastmillis1;

That doesn't look good.