-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
GC is too lazy, sometimes #54937
Comments
Julia 1.10 generally des a lot better here. Can you try upgrading to 1.10.4? |
Thanks for the reply!
Sorry, you may have missed this but I mentioned this failing in a 1.10.4 test environment as well - see the second to last quote block.
installed via juliaup, itself installed via the windows app store. Edit: I tested a bit more on windows and was able to reproduce with 1.10.2,1.10.4,1.11, as well as nightly. Here's the versioninfo from nightly:
On windows, I eventually start seeing a string of messages like
then
and finally julia as well as the terminal window where it was running are both killed. |
As a side note, I'm not entirely sure why 10G of strings should take 90G of memory, regardless of GC. |
In my experience, if you want to cause the GC to free all memory available for freeing, |
Can you do |
@gbaraldi Initially I got a bunch of messages like so: This while julia is maxing the memory available to the system. Eventually I was shown this by windows: ![]() And shortly afterwards the julia terminal was forcibly closed. I'll try running this again a bit later in a terminal that keeps logs of output to see whether anything more interesting is shown by the GC debug output right before julia dies. |
Well it seems that the memory it's allocating is not being freed, not that the GC isn't running. But deserves a further look anyway |
Agreed. I guess it's more of a memory leak than GC not running.
My current suspicion is that having an excessive amount of tasks fills up the memory while context switching. I will try this again with a feeder task/channel and a finite amount of consumer threads. |
Well, using a feeder thread with a fixed amount of workers keeps the julia process using a fixed amount of memory. Sorry for the noise. |
You seem to understand the issue and fix, but it's unclear if others will and would blame the GC. Can and should something be documented about this, that isn't currently done? |
Hi!
I'm experiencing issues in different contexts where GC doesn't run, eventually exhausting the available memory and often having OOM killer kill the julia process, despite GC having the possibility to clean much memory. I have experienced this both in numerical loops that happen to allocate memory as well as in simple data processing;
MWE:
Focusing on resident memory;
In a fresh julia session, I have julia using about 200M :
After running the code above with
/data
having a roughly 25k files of roughly equal size, totaling ~10GB, Julia process is consuming almost 90G (which seems slightly excessive even if everything was actually loaded at once):After
GC.gc()
we're back to using 300M:Finally after
![Screenshot 2024-06-25 at 19 15 19](https://private-user-images.githubusercontent.com/2652983/342992686-fc50f53c-5e89-4a45-9168-d9b8b816e24f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3NTE3OTcsIm5iZiI6MTcxOTc1MTQ5NywicGF0aCI6Ii8yNjUyOTgzLzM0Mjk5MjY4Ni1mYzUwZjUzYy01ZTg5LTRhNDUtOTE2OC1kOWI4YjgxNmUyNGYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYzMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MzBUMTI0NDU3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9N2ExNTAzMTQzYmNlNjUwZmE4MTljNDAzMWEzNjFkYTg2NjkwZDBjOWM4ZDk5OTIwNTg5OWU0NDc0N2E0OGZkZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.799lEe94J1W4AZZ7IT9Oxbno9BfQboyUgUpyK_34DZ8)
GC.gc(true)
we're up to using 400M although virtual memory usage decreased.If I add a
Base.Event
lock insidesearch
, memory usage does not begin to increase until theEvent
isnotify
ied, so this is not due to creating excessive tasks eg. Alternatively, if I replace the@spawn
loop by a simplemap
or even aDistributed.pmap
(without using a channel to communicate back results), memory remains bounded. However, if I do the processing via@Distrubuted.spawnat :any search(channel,fn)
in a loop/map, memory grows again, and again is released with an@everywhere GC.gc()
.A different context where I experienced this completely unrelated to channels (although it was run in parallel using
pmap
), was in code that allocated new matrices in a loop for the minors of a larger matrix. A manualGC.gc()
at the end of every iteration maintained a constant usage instead of having it grow unbounded (until I refactored the code to avoid allocations altogether).First experienced here:
this is via the following container running in podman on linux with the following image: https://hub.docker.com/layers/jupyter/datascience-notebook/x86_64-julia-1.9.3/images/sha256-98c2b44b4e44e044a8670ac27b201704e5222f8a7d748eb7cfd94a2cdad52e7d
As a test environment I attempted to run this in a test environment; in a fresh ubuntu podman container downloaded julia tarball from julialang.org, unpacked inside
/opt/
, run by path:root@fc72b99c6484:/opt# julia-1.10.4/bin/julia -t 8
On the host:
The text was updated successfully, but these errors were encountered: