-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Explicit GC.gc call does not reclaim memory on 1.11 and master #54020
Comments
Explicit GC doesn't reset the heuristics, so even if we collect a lot of the memory at once (which will start to reduce the thresholds somewhat based on a discounted moving average), we will continue to assume you have enough swap (probably 2x memory used to be enough, but with SSD speeds these days now, it might need to be a lot more) available to handle the transient memory load without needing to reduce overall performance to stay within the memory budget. |
What does /usr/bin/time -v report for your maxrss values? |
I have no swap, could that be the reason? /usr/bin/time -v reports the following (I shortened to relevant info), first is one call to
|
Ah yeah, if you don't have swap, then your system is likely to run a lot slower and crash more |
Ah, well, shame. But in any case, regarding your initial comment:
The issue here is precisely that no memory is collected at all whereas it should when explicitly calling |
Definitely seems like a bug.
I'm not sure if this is a bug. It's always been my understanding that a single
This is off-topic and also quite rude??! |
No no, this is relevant: if julia expects the user to have swap, then the entire issue could be moot because then there is no bug in julia, but a system incompatibility instead. As far as I know, using julia does not require having swap space though, having it is simply better for GC heuristics ; if it was needed it should be in the documentation, or even in the requirements in the README. |
I don't consider this an issue, this workload makes it so we need to have about 6.8GB in memory at once, given that GCs are expected to have some space overhead it will use more than that. The issue of running without swap is that it doesn't allow for any overhead and makes the OS keep everything in memory. If you don't want to use swap then I would recommend setting the flag to a safe amount. |
And btw @Liozou if you want to see how much the GC is freeing |
I'll test this and let you know later when I can get back to my computer. |
Here is a simple setup that makes julia memory leak until it is killed by the OS (x86 linux, glibc), on a single thread:
I have 8 GiB of RAM available after executing the above. Calling
bar(n)
once uses around 6.7GiB for any value ofn
between 1000 and 100_000. That's fine, and this memory used to create and fillx
should be reclaimable by GC. But callingbar(n)
a second time then crashes julia, even if the two calls are separated byGC.gc(false); GC.gc(true)
. This occurs on v1.11.0-alpha2 and master (d183ee1), but not on 1.10.2.(for the sake of completeness, this also used to work on v1.6.6 and v1.7.3, it crashed on v1.8.5 unless an explicit
GC.gc()
was called between the twobar(9000)
, and it crashed on v1.9.4 which might be related to #50345)Irrespective of it being a regression without calling
GC.gc
, the fact that an explicitGC.gc
call does not reclaim the free memory looks like a bug to me. See also #51818, but here functionbar
exited before the call toGC.gc
.The text was updated successfully, but these errors were encountered: