-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heap space not released until OOM? #465
Comments
Hello, Thank you for providing a clear description. It was easy to understand and reproduce. In short, if you only re-execute a cell (without a kernel restart), it doesn’t release any old "version" of that variable (and doesn’t release memory allocated to the previous ones). More specifically: we store instances for all executed snippets and may reference these values even if they are hidden with the variables defined later. That's why we have hard references to all objects that were defined as variables in all the snippets. And as a result, repeatedly executing this cell will lead to an OutOfMemoryError over time. Also we already have a bit similar task (for improvement UX in similar cases) in a Kotlin Notebook project in our YouTrack Did I answer your question? Has it become clearer now? |
Thank you for reprocessing and the clarification, at least I know, that I was not doing it wrong. Unfortunately, restarting the kernel is not a good option for me, because this way I'd loose data loaded in earlier cells and would have to execute the entire notebook from the start. And I still see no reason, why the kernel should keep the data from previous executions, because it would not be accessible anymore once a variable is overridden. Are there plans to change this? |
Ah, thanks. I didn't know that I can access these varaibles via I must admit, that don't know, what Re-executing cells usually happens while I write my notebook, i.e. I change the code and try it until it works. And when I run into the OOM-Error, I have to restart the kernel and execute the notebook from the beginning. Together with kotlin-dataframe's high memory consumption (Kotlin/dataframe#141), this happens frequently. |
in general it sounds nice, but this question is discussable.
and thank you for your questions! It let us to get new point of view and very useful for future improvements.
This part is quite interesting.
It should help in case if you don't often change the original dataset (file) Another option: if you use IntelliJ IDEA (Ultimate Edition) and plugin Kotlin Notebook you can set heap size manually via settings and it also should help a bit (if you have enough memory) |
Thanks for the tips. I already increased the memory limit when iI first encountered the OOM-Error. And splitting the code into smaller cells would help, too. But all this only postpones the problem. With a growing notebook I guess I would always hit the memory limit sooner or later. So some mechanism to release memory should be implemented. If access to values from former executions of cells is a valuable feature (actually, I don't feel the need for that), a way to throw away data explicitly would be helpful, so users can actively decide that they don't need that data anymore. |
thank you for your ideas! I filed an issue in our tracker (Kotlin Notebook) and you can vote for it if you wish. |
Hello,
I'm experiencing increasing memory consumption of a notebook until I end up with a "java.lang.OutOfMemoryError: Java heap space", althoug I'm just re-execution the only cell the notebook.
Here is my example using Kotlin Dataframe:
The .csv-file is about 260MB big, but I guess that shouldn't matter, just influence how long it takes to be out of memory.
As I re-execute this cell again and again I can see the memory consumption of the kernel's Java process increase until it hits the memory limit I configured and I end up with the OutOfOfMemoryError. While the kernel keeps the content of
data
for subsequent cells, I would expect it to release any old "version" of that variable when I re-execute the cell. Hence, the memory consumption should not increase with every execution.Seems like a bug to me. Or am I doing it wrong? Or just misunderstanding how it's supposed to work?
The text was updated successfully, but these errors were encountered: