• Damien George's avatar
    py/gc: Improve calculation of new heap size in split-heap-auto mode. · 97b13132
    Damien George authored
    
    
    There are two main changes here to improve the calculation of the size of
    the next heap area when automatically expanding the heap:
    - Compute the existing total size by counting the total number of GC
      blocks, and then using that to compute the corresponding number of bytes.
    - Round the bytes value up to the nearest multiple of BYTES_PER_BLOCK.
    
    This makes the calculation slightly simpler and more accurate, and makes
    sure that, in the case of growing from one area to two areas, the number
    of bytes allocated from the system for the second area is the same as the
    first.  For example on esp32 with an initial area size of 65536 bytes, the
    subsequent allocation is also 65536 bytes.  Previously it was a number that
    was not even a multiple of 2.
    Signed-off-by: default avatarDamien George <damien@micropython.org>
    97b13132
gc.c 47.2 KB