Different memory usage in identical devices

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Different memory usage in identical devices

Post by devnull » Sun May 14, 2017 12:12 am

Can't figure this out, I have 2 identical ESP12/8266 devices and have disabled boot.py and main.py and when I compare the memory usage of both devices they are different, one has about 5% less available than the other.

This is resulting in one of them not being able to run code that the other one can.

Immediately after reboot, they appear to be the same, but when I import a frozen file (import sh) which is identical on both systems, the available ram on 1 device is 5% less than the other one !

Can anyone suggest why this might be ?? - I have verified this several times.

Also, what do the various chars "=ABh." mean in the memory map ?

First Device

Code: Select all

>>> import micropython
>>> micropython.mem_info(1)
stack: 2144 out of 8192
GC: total: 36288, used: 5072, free: 31216
 No. of 1-blocks: 17, 2-blocks: 7, max blk sz: 263, max free sz: 1942
GC memory layout; from 3ffef2c0:
00000: h=AhhBMh=Dh=hDhB=BBBh===h====ABhhh==h===========================
00400: ================================================================
00800: ================================================================
00c00: ================================================================
01000: ===========================================h==h===h===h=B.....h=
01400: ....h=..........................................................
       (29 lines all free)
08c00: ............................
>>> import sh
>>> micropython.mem_info(1)
stack: 2144 out of 8192
GC: total: 36288, used: 12080, free: 24208
 No. of 1-blocks: 113, 2-blocks: 28, max blk sz: 263, max free sz: 1504
GC memory layout; from 3ffef2c0:
00000: h=hhhhMh=Dh=hDhB=BBBh===h====h==hh==h===========================
00400: ================================================================
00800: ================================================================
00c00: ================================================================
01000: ===========================================h=hhh=hhhhSh=hhBhAhh=
01400: =hhMhhDBh=h=BDBBBh=================h==h==hh=h=======h===========
01800: ================================================================
01c00: ================================================================
02000: ===============hhh=hhhh==hh====hhh=hhhh==hh======hhh=h======h===
02400: ====h==hhh==hh=hhh=hhhh==hh=hh============Shh=hhhh====hhh=hDhhhh
02800: ======hh===Shhh=BABBDBBh===h=h===BDBBh=h===BDTBh=B=h===BDBBhh=h=
02c00: ==BDBBh=h===hhhhhhh=h===TB=BBh===B.........h=h==============....
       (23 lines all free)
08c00: ............................
>>> 
Second Device

Code: Select all

>>> import micropython
>>> micropython.mem_info(1)
stack: 2144 out of 8192
GC: total: 36288, used: 5072, free: 31216
 No. of 1-blocks: 17, 2-blocks: 7, max blk sz: 263, max free sz: 1942
GC memory layout; from 3ffef2b0:
00000: h=AhhBMh=Dh=hDhB=BBBh===h====ABhhh==h===========================
00400: ================================================================
00800: ================================================================
00c00: ================================================================
01000: ===========================================h==h===h===h=B.....h=
01400: ....h=..........................................................
       (29 lines all free)
08c00: ............................
>>> import sh
>>> micropython.mem_info(1)
stack: 2144 out of 8192
GC: total: 36288, used: 10880, free: 25408
 No. of 1-blocks: 112, 2-blocks: 28, max blk sz: 263, max free sz: 1579
GC memory layout; from 3ffef2b0:
00000: h=hhhhMh=Dh=hDhB=BBBh===h====h=hhh==h===========================
00400: ================================================================
00800: ================================================================
00c00: ================================================================
01000: ===========================================h=hhh==hh=hh=hhBh=hhh
01400: hhhMh=DBShh=BDBBBh=================hh=======h=======h===========
01800: ================================================================
01c00: =====h==h==h=hhh=hhhh==hh====hhh=hhhh==hh======hhh=hhhh==hh=hhh=
02000: =====hhShhh==hh==h==h============h=hhhh====hhh=hDhhhh======hh===
02400: Shhh=BABBDBBh===h=h===BDBBh=h===BDTBh=B=h===BDBBhh=h===BDBBh=h==
02800: =hhhhhhh=h===TB=BBh===B.........h=h==============...............
       (24 lines all free)
08c00: ............................
>>> 

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Different memory usage in identical devices

Post by dhylands » Sun May 14, 2017 1:47 am

See this thread:
viewtopic.php?f=2&t=3287
for a discussion of interpreting the mem_info output.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Different memory usage in identical devices

Post by Damien » Mon May 15, 2017 10:18 am

The firmware on the 2 devices are not identical. The heap on the second one starts 16 bytes later in RAM. See the 3ffef2c0 vs 3ffef2b0 numbers.

Sent from my GT-I9105P using Tapatalk

Post Reply