-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default RAM size in UNIX build #1433
Comments
You can use:
to get a 1Mb heap. The default heap was set to match stmhal so that similar scripts would have similar memory usages. I would imagine that adding a MICROPY_DEFAULT_HEAP_SIZE option which defaulted to 128K but which could be overriden at build time would be acceptable. |
Hi Dave, thanks for the help. I didn't aware of -X option. I will rebuild it with increased heap size, just wanted to feedback my experience on LINUX. Béla |
I also hit the 128k limit quite often on unix. I'd be open to increasing the default to around 1M. |
To remind, unix version's heap set to 128K on 32-bit systems (double that on 64-bit) to be close to stmhal version, with the premise that one of the expected uses of unix version would be debugging "embedded" applications. Now that that unix version offer much more complete environment, with good subset of stdlib, package manager, I guess it indeed makes sense to increase default heap size. Also, probably mention heap size issue in the README if people miss to run |
Ok, 1m or 2m or 4m or? Sometimes I use 10m to be safe when running some code for a while, but usually 1-2m is enough. Happy to mention heapsize option in README. |
Let's stay conservative and use 1MB (32bit) - we know that larger heaps may hurt performance. Actually, would be nice to test pystone first ;-). |
Well, I don't see any noticeable degradation with |
Ok, 1wm sounds good. |
I'm on it. |
Looks good, now my scripts runs fine without -X heapsize=... However on a LINUX system 1m seems to be low. I would vote for 4-8m. But we will see. Thanks |
@ha5di : Feel free to implement #1168 , and there will be all memory available. Otherwise, the ideas behind MicroPython is to prove that it's possible to write resource-efficient apps in Python, and teach people how to do that. And making sure people are aware that resources are finite is first step to that ;-). Of course, specific figures may vary over time, and we can revisit it in half a year. Good argument for adjusting would be "many people use unix version of uPy now" (hint-hint, spread the word ;-) ). |
I'm spreading it. Added MicroPython to the new piCore-7.0 Linux base. It is a unique system with only a few megs base system, applications are in squashed read only files loop mounted and symlinked at startup. I rewrote the startup extension mounter in MicroPython (original is ash). Now it takes 50% of the time only, and it is single threaded. Will test a multithread version. Adding MicroPython to the minimalistic core and rewriting crutial shell scripts significantly boosts performance where no room for a full blown Python. bmarkus |
Great! If you have any links (code/docs/discussion), please share them, I'd like to take a peek when I have a time. So, if you face any issues 1MB heap, please report it, and we'll bump it. Just understanding when it happens will allow to make better decisions on default heap size. Because otherwise any figure is arbitrary - I for example had to run uPy with hundreds of megs heap. But garbage collection takes seconds on such heap sizes, so setting heap higher than needed will affect all apps even those which don't need such heap. |
Sounds great @ha5di! Any feedback you have on using uPy in the wild is very valuable and can be used to improve it. |
Added header image and license badge
Default RAM size for UNIX build is 128k which is too low, in a UNIX system you have much more available and in practice you run out of memory frequently working with dictionaries, lists.
Advice to set default value to few megabytes, like 4M.
The text was updated successfully, but these errors were encountered: