Ewon Flexy 102 Reboot unexpectedly

The problem is that Flexy reboots unexpectedly, and sometime when I connect remotely via eCatcher or M2Web, the Flexy also reboots.
Some time the log file show that: Reboot reason: Unknown (power loss,…) , some time it show Reboot Reason: Not Enough memory
I tried to optimize my Basic Script code, but the issue is still there.
Please help us to deal with this.

Please see the Flexy backup file in the attachment.
MOVED TO STAFF NOTE (225.5 KB)

I would start by removing the code from the Cyclic section. It is most likely causing the memory leak. You can replace this with a timer that runs every second.