py/gc - dynamic alloc threshold #18897
mzakharocsc
started this conversation in
Ideas
Replies: 2 comments
-
|
Looks interesting, |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Please see below for minimum implementation: Missing how to parametrise threshold fraction parameters (hard coded to 2/3): |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem: gc_alloc_threshold in py/gc.c is set statically. however, this is a probllem under memory pressure, amount free after sweep can be less than gc_allloc_threshold amount - essentially rendering this feature useless at preventing memory fragmentation.
Proposal: dynamic gc_alloc_threshold. After sweeping, in gc_alloc(), adjust gc_alloc_threshold to be some fraction of free (2/3, 3/4) -etc (configurable). In our testing 2/3 works really well.
With the proposed change, our production firmware was able to operate without memory fragmentation issues under much lower memory budget.
Beta Was this translation helpful? Give feedback.
All reactions