Skip to content

Commit

Permalink
py/gc: Allow the GC heap to be split over multiple memory areas.
Browse files Browse the repository at this point in the history
This commit adds a new option MICROPY_GC_SPLIT_HEAP (disabled by default)
which, when enabled, allows the GC heap to be split over multiple memory
areas/regions.  The first area is added with gc_init() and subsequent areas
can be added with gc_add().  New areas can be added at runtime.  Areas are
stored internally as a linked list, and calls to gc_alloc() can be
satisfied from any area.

This feature has the following use-cases (among others):
- The ESP32 has a fragmented OS heap, so to use all (or more) of it the
  GC heap must be split.
- Other MCUs may have disjoint RAM regions and are now able to use them
  all for the GC heap.
- The user could explicitly increase the size of the GC heap.
- Support a dynamic heap while running on an OS, adding more heap when
  necessary.
  • Loading branch information
aykevl authored and dpgeorge committed Jul 22, 2022
1 parent 5dbb822 commit bcc827d
Show file tree
Hide file tree
Showing 4 changed files with 493 additions and 318 deletions.
Loading

0 comments on commit bcc827d

Please sign in to comment.