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

Classes

Debug

Debug options for the garbage collector.

Functions

is_tracked

Returns True if document is tracked by the garbage collector.

track

Add document to garbage collector tracking list. Returns False if document was already tracked.

untrack

Remove document from the garbage collector tracking list.

collect

Explicitly call garbage collector once.

enable

Enable automatic garbage collection.

disable

Disable automatic garbage collection.

isenabled

Returns True if automatic collection is enabled.

get_count

Returns the number of currently tracked objects.

get_threshold

Return the current threshold.

set_threshold

Set the garbage collector threshold, 0 disables collection. Negative values raise ValueError.

get_executor

The executor assigned to the garbage collector.

set_executor

Assign an executor to the garbage collector.

set_debug

Set debug options for the garbage collector.

get_debug

Return a copy of the current debug options of the garbage collector.


󰊕 Functions

is_tracked(arg: syside.SharedMutex[syside.BasicDocument], /) bool

Returns True if document is 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 False if document was already tracked.

untrack(arg: syside.SharedMutex[syside.BasicDocument], /) bool

Remove document from the garbage collector tracking list.

Returns False if 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 True if 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.