Memory sometimes keep decreasing until restart (memory leak?)

hi, currently im experiencing inconsistencies in the hardware behavior.
i deploy code with memory monitoring every 10 seconds.
i have 5 device. but sometimes 1 or more device will experience memory decrease and eventually restarted.
my line of code is more than 5000, and the free memory after booting is around 35k. im not sure where the memory leak in the code.
i didnt find any useful information related to memory leak in the forum.

Can you DM with a device id / mac address and approximate timestamp of an out of memory restart? We might be able to narrow down the source of the leak from the crash reports.