Garbage collector configuration¶
incminimark garbage collector is configurable through
several environment variables:
- The nursery size.
Defaults to 1/2 of your cache or
4M. Small values (like 1 or 1KB) are useful for debugging.
- If set to non-zero, will fill nursery with garbage, to help debugging.
- The size of memory marked during the marking step. Default is size of nursery times 2. If you mark it too high your GC is not incremental at all. The minimum is set to size that survives minor collection times 1.5 so we reclaim anything all the time.
- Major collection memory factor.
1.82, which means trigger a major collection when the memory consumed equals 1.82 times the memory really used at the end of the previous major collection.
- Major collection threshold’s max growth rate.
1.4. Useful to collect more often than normally on sudden memory growth, e.g. when there is a temporary peak in memory usage.
- The max heap size.
If coming near this limit, it will first collect more often, then
raise an RPython MemoryError, and if that is not enough, crash the
program with a fatal error.
Try values like
- The major collection threshold will never be set to more than
PYPY_GC_MAX_DELTAthe amount really used after a collection. Defaults to 1/8th of the total RAM size (which is constrained to be at most 2/3/4GB on 32-bit systems). Try values like
- Don’t collect while the memory size is below this limit. Useful to avoid spending all the time in the GC in very small programs. Defaults to 8 times the nursery.
- Enable extra checks around collections that are too slow for normal
1(on major collections) or
2(also on minor collections).
- The maximal number of pinned objects at any point in time. Defaults to a conservative value depending on nursery size and maximum object size inside the nursery. Useful for debugging by setting it to 0.