gc
Internal GC interface.
Currently only Documents are collected by the internal garbage collector. This hooks
into Python GC and breaks reference cycles between documents no longer reachable from
Python.
Index
Functions
Returns |
||
Add document to garbage collector tracking list. Returns |
||
Remove document from the garbage collector tracking list. |
||
Explicitly call garbage collector once. |
||
Enable automatic garbage collection. |
||
Disable automatic garbage collection. |
||
Returns |
||
Returns the number of currently tracked objects. |
||
Return the current threshold. |
||
Set the garbage collector threshold, 0 disables collection. Negative values raise |
||
The executor assigned to the garbage collector. |
||
Assign an executor to the garbage collector. |
||
Set debug options for the garbage collector. |
||
Return a copy of the current debug options of the garbage collector. |
Functions
- is_tracked(arg: syside.SharedMutex[syside.BasicDocument], /) bool
Returns
Trueifdocumentis tracked by the garbage collector.
- is_tracked(arg: syside.BasicDocument, /) bool
- track(arg: syside.SharedMutex[syside.BasicDocument], /) bool
Add document to garbage collector tracking list. Returns
Falseif document was already tracked.
- untrack(arg: syside.SharedMutex[syside.BasicDocument], /) bool
Remove document from the garbage collector tracking list.
Returns
Falseif document was not tracked.
- untrack(arg: syside.BasicDocument, /) bool
- collect() None
Explicitly call garbage collector once.
- enable() None
Enable automatic garbage collection.
- disable() None
Disable automatic garbage collection.
- isenabled() bool
Returns
Trueif automatic collection is enabled.
- get_count() int
Returns the number of currently tracked objects.
- get_threshold() int
Return the current threshold.
- set_threshold(arg: int, /) None
Set the garbage collector threshold, 0 disables collection. Negative values raise
ValueError.Garbage collector will automatically run only when it tracks more than threshold new objects since last collection.
- get_executor() syside.Executor | None
The executor assigned to the garbage collector.
- set_executor(arg: syside.Executor | None) None
Assign an executor to the garbage collector.
Without an executor, the garbage collector always runs on the thread that invokes it, e.g. the main thread. In addition to processing documents concurrently, documents will also be destroyed asynchronously further improving performance.
- set_debug(arg: syside.gc.Debug, /) None
Set debug options for the garbage collector.
By default, everything is printed to
stderr.
- get_debug() syside.gc.Debug
Return a copy of the current debug options of the garbage collector.