Micropython data stored in Heap

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Micropython data stored in Heap

Post by deshipu » Mon Oct 24, 2016 8:54 am

Chinkal wrote: I also want to implement restart function so whenever the system reboots, It will check the file whether it has any previously stored data and version information. If yes then it should start executing the program after that checkpoint().

Is there any way I could implement this?
No, and that's what we were trying to tell you here.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Micropython data stored in Heap

Post by pythoncoder » Tue Oct 25, 2016 8:23 am

The reason is because program state comprises much besides local and global variables. The most obvious is the stack which stores (amongst other things) the points in the code where execution must be resumed after a function or method terminates. If you think about this, it can't be determined a priori because a function or method can be called from many places in a program.

I suggest doing some general reading on the mechanics of program execution. Perhaps someone can recommend a suitable text.
Peter Hinch
Index to my micropython libraries.

Post Reply