What are the 1 and 2 blocks #11997
-
I've been trying to better understand memory operations now that I can visualize them over time, and there is more happening onder the bonnet than I grok. There are some docs on me management that I've read a few times, but I can't find a description of the 1/2 blocks. What are these exactly? Also a few sanity checks
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
You will probably find this helpful (talk on the MicroPython garbage collector): https://www.youtube.com/watch?v=H_xq8IYjh2w |
Beta Was this translation helpful? Give feedback.
-
No. Generally the stack size (or at least a minimum stack size) is hard-coded in the linker file for an embedded port. The stack and heap sizes are not modified at runtime. |
Beta Was this translation helpful? Give feedback.
-
Blocks are chunks of contiguous of memory in the heap. The size is configured by 1-blocks are blocks memory that has been allocated for an object that requires <= the number of bytes in one block. Small objects like |
Beta Was this translation helpful? Give feedback.
-
These numbers are all in blocks. This means the largest object that has been allocated uses 72 contiguous blocks (max block sz) and the largest contiguous region of unallocated blocks is 328 blocks (max free sz). |
Beta Was this translation helpful? Give feedback.
Blocks are chunks of contiguous of memory in the heap. The size is configured by
MICROPY_BYTES_PER_GC_BLOCK
. The default is the size of 4 pointers, so 16 bytes on 32-bit arch and 32 bytes on 64-bit arch.1-blocks are blocks memory that has been allocated for an object that requires <= the number of bytes in one block. Small objects like
floats
fit in to one block. 2-blocks are two contiguous blocks which are allocated for object that are too big to fit in one block but small enough to fit in two blocks.