garbage_collect

The garbage_collect method runs full garbage collection. It is performed in Python first; then, the underlying JVM runs its garbage collector twice due to the cross-referencing nature of the Python/Java integration in Deephaven.

Note

Since there is no way to force the Java garbage collector to run, the effect of calling this function is non-deterministic. Users should also be mindful of the overhead that running garbage collection generally incurs.

Syntax

Parameters

This method takes no arguments.

Example

The following example uses Deephaven's perfmon (performance monitor) library's server_state method to print the amount of memory Deephaven is currently using at various points throughout the query - at the beginning, when objects are created and deleted, and finally after garbage_collect is called. The data in the UsedMemMiB column tracks how much memory is currently being used.

The log readout from the above example