Free RAM on MicroPython boards

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Free RAM on MicroPython boards

Post by rcolistete » Wed Oct 19, 2016 1:26 pm

bmarkus wrote:On a LoPy v1.0 board with stock firmware

Code: Select all

>>> import gc
>>> gc.collect()
>>> gc.mem_free()
191088
>>>
Thanks. Please state the firmware version.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: Free RAM on MicroPython boards

Post by kfricke » Wed Oct 19, 2016 2:29 pm

The LoPy firmware does only print a commit hash suffix but no MicroPython release number. So only Pycom knows which MicroPython release we do use there.

User avatar
bmarkus
Posts: 111
Joined: Tue Oct 21, 2014 5:58 am

Re: Free RAM on MicroPython boards

Post by bmarkus » Wed Oct 19, 2016 2:46 pm

kfricke wrote:The LoPy firmware does only print a commit hash suffix but no MicroPython release number. So only Pycom knows which MicroPython release we do use there.

Code: Select all

import os
os.uname()
returns a tuple with release, version and other parameters. On my board release='0.9.0b' whatever it means.
Tiny Core Linux (piCore) developer
HAM radio call: HA5DI (Béla)

User avatar
Frida
Posts: 45
Joined: Sat Jan 30, 2016 2:20 pm
Location: Middelfart, Denmark

Re: Free RAM on MicroPython boards

Post by Frida » Wed Oct 19, 2016 5:03 pm

Code: Select all

>>> import os
>>> os.uname()
(sysname='LoPy', nodename='LoPy', release='0.9.0.b2', version='f5444c7 on 2016-10-12', machine='LoPy with ESP32')

Code: Select all

>>> import gc
>>> gc.collect()
>>> gc.mem_free()
191216
Yes Frida is my watchdog!

User avatar
bmarkus
Posts: 111
Joined: Tue Oct 21, 2014 5:58 am

Re: Free RAM on MicroPython boards

Post by bmarkus » Fri Oct 21, 2016 5:45 pm

Updated LoPy to 0.9.1.b1 firmware released today. Now free RAM is only 71152 bytes Also, every execution of gc.mem_free() is decresing it by 64 bytes :(
Tiny Core Linux (piCore) developer
HAM radio call: HA5DI (Béla)

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Free RAM on MicroPython boards

Post by rcolistete » Sun Oct 23, 2016 5:47 am

bmarkus wrote:Updated LoPy to 0.9.1.b1 firmware released today. Now free RAM is only 71152 bytes Also, every execution of gc.mem_free() is decresing it by 64 bytes :(
Answer from here :
71,152 is the expected value for now. We will increase it in future releases, and we should end-up with something around 150K. The old value of 191,088 was wrong and that was causing the gc crashes.

Calling gc.mem_free() on the REPL will decrease the value as it creates new objects. As soon as you call gc.collect() the free memory amount will increase again.

Cheers,
Daniel
So the free RAM on LoPy (and possibly WiPy 2.0) is a moving target. Hoping to see about 150 KB of free RAM.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Free RAM on MicroPython boards

Post by rcolistete » Wed Nov 02, 2016 5:53 pm

Added firmware/MicroPython versions for most of the boards in 1st post. I'll later update Pyboard line with the MicroPython version.
Last edited by rcolistete on Wed Nov 02, 2016 8:22 pm, edited 1 time in total.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Free RAM on MicroPython boards

Post by Roberthh » Wed Nov 02, 2016 8:05 pm

Today's commit for ESP8266 increased the heap and this the available RAM by 8k.

User avatar
kamikaze
Posts: 154
Joined: Tue Aug 16, 2016 10:10 am
Location: Latvia
Contact:

Re: Free RAM on MicroPython boards

Post by kamikaze » Sat Nov 05, 2016 4:54 am

Teensy 3.6:

Code: Select all

>>> __import__('gc').mem_free()
233920

Code: Select all

>>> del machine
>>> del pins
>>> del pyb
>>> del led
>>> del af
>>> __import__('gc').collect()
>>> __import__('gc').mem_free()
234496

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Free RAM on MicroPython boards

Post by rcolistete » Wed Nov 09, 2016 6:45 pm

Roberthh wrote:Today's commit for ESP8266 increased the heap and this the available RAM by 8k.
Thanks. Hope to see it in v1.8.6. Constrained RAM is one of the limitations of ESP8266, so this increase will be very useful.

1st post updated with free RAM for LoPy and WiPy2, firmware v0.9.3.b2 with 77KB, 8KB more than previous version.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

Post Reply