Im currently on v1.1.1 using iJulia/Jupyter - i cant find a working method for garbage collection - workspace() and gc() aren’t recognized in REPL or iJulia. Any suggestions?
Button restart kernel?
i want to delete tmp vars inside functions to free up memory
Can you give an example of what you mean? Any variables allocated within a function which are not returned or stored somewhere will automatically be cleaned up without you needing to do anything.
This doesn’t happen immediately though. I had a DataFrame taking up 22Gb of my 32Gb system. I reassigned the variable to an empty DataFrame, but the memory was still occupied. I had to kill the Julia process in order to run some other memory-intensive (non-julia) programs.
Sure, if the Julia process needs more memory, it can be freed up, but it would be nice to be able to trigger gc manually.
GC.gc()
should do the trick most of the time… Otherwise, the OS will take care of it by using the cached pages or swapping aggresively whatever is not needed. Having a large swapfile on very fast storage i.e. NVME raid (2-4GB/s) can help a lot for memory-intensive tasks but it still is an expensive option.
Ahh, yes. That’s what I needed… I think it used to be exported (so you didn’t need the GC.
part) - a bunch of things I found with searching mentioned that, but I figured it had been removed.
this is what i was looking for - thanks