dflib / jjava

A Jupyter kernel for Java notebooks
MIT License
18 stars 2 forks source link

Fix memory leak #4

Closed stariy95 closed 6 months ago

stariy95 commented 6 months ago

Running multiple times a simple snippet could lead to a memory leak.

DataFrame df = DataFrame
        .foldByColumn("1", "2")
        .ofStream(IntStream.range(0, Integer.MAX_VALUE / 8));

JShell defines local variable df multiple times and could generate several synthetic classes that will hold the data of that variable, while there's no class unloading right now implemented.

Workaround for this is just restart kernel in the Jupyter.

stariy95 commented 6 months ago

Added experimented fix, that deals with redefined variables and unloads class linked to the older definition. More work is needed in order to fix other cases that could lead to a memory stuck in the JShell classloading implementation.