meaning for GC report number

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
wghe
Posts: 9
Joined: Fri Mar 08, 2019 6:12 pm

meaning for GC report number

Post by wghe » Thu Mar 14, 2019 7:58 pm

Hi

Could anyone please to explain following GC number from machine.info()?

Code: Select all

>>> machine.info()
GC:
102784 total
2112 : 100672
1=56 2=23 m=8


Thanks in advance!

Regards,
WG

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

Re: meaning for GC report number

Post by dhylands » Thu Mar 14, 2019 9:11 pm

102784 is the total number of bytes in the heap
2112 is the number of bytes which are currently in use in the heap
100672 is the number of free bytes in the heap.
1=56 means that there are 56 heap allocations which take up a single block.
2=23 means that there are 23 heap allocations which take up 2 blocks
m=8 means that the largest allocated object in the heap is 8 blocks

On the pyboard, a block is 16 bytes.

wghe
Posts: 9
Joined: Fri Mar 08, 2019 6:12 pm

Re: meaning for GC report number

Post by wghe » Thu Mar 14, 2019 9:44 pm

Hi Dave,

Very clear and got it! :)

Best regards,
WG

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

Re: meaning for GC report number

Post by pythoncoder » Sat Mar 16, 2019 7:41 am

There is also micropython.mem_info() which is more descriptive. An optional 1 arg provides a memory map.
Peter Hinch
Index to my micropython libraries.

Post Reply