garbage_collect

The garbage_collect method runs full garbage collection in Python first. It then requests that the JVM run its garbage collector twice, because Python and Java objects in Deephaven can hold references to each other.

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 prints the JVM's used memory at each step: at the start, after each table is created, after the reference is deleted, and after garbage_collect is called. It also creates the mem table with the server_state method of Deephaven's perfmon (performance monitor) module. The UsedMemMiB column in mem tracks how much memory is in use over time.

For a step-by-step version of this example, with the printed output and what it shows, see How to run full garbage collection.