There is another object which you are creating, never used and never freed.
Why do you create the ds3231 object in a timer callback? Create it once in mgos_app_init and pass the pointer to the timer callback.
Ex:
I added the above logic in my code but still, Losing RAM.
After Ram is empty it stuck in the reboot loop with core dumping procedure.
If i used free(ctx); then it give the abort() and the error is Corrupt heap .
if not then it start leaking the heap as it does previously.
Can you tell me another solution?
Thanks for the above.
Don’t free(ctx). It must leave as long as the application leaves.
Did you remove or comment out struct mgos_ds3231_date_time *dt = mgos_ds3231_date_time_create(); in imu_cb?