-
-
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
GC behavior when memory is almost full #6103
Comments
Good garbage collection is a tradeoff of time and memory allocation. I recommend you save time and buy enough memory to contain your data. MATLAB has a rather poor memory management configuration which requires it to call gc() whenever you leave a function call. They have since improved it quite a bit in the last few years, but I'm stuck with an older version of MATLAB for other reasons, and so it is not uncommon for me to wait several minutes for gc to run after running small functions. That is not a good model to copy. (btw, the GC /did/ run on the next allocation, however, the old matrix hadn't yet been unreferenced at that point, so it couldn't free it. perhaps julia could speculatively dereference LHS variables before calling the RHS function, but that would break if the RHS threw an error, and it probably would only help in artificial tests anyways) |
Perhaps one thing to say here is that the GC currently doesn't take memory-almost-full conditions into account. It could potentially try harder to collect if physical memory is getting full. |
But shouldn't it run after the |
True, but we also grow the threshold. The nastiness here is that at a certain point we do a single allocation that's bigger than the whole threshold. Before that allocation we don't appear to need GC. Perhaps this should be a special case of some kind. |
Possible strategies? (Separately or in combination?)
|
We do have libuv functions uv_get_free_memory and uv_get_total_memory available |
This issue was last updated long before v0.4.0-rc2. Is it still an issue after many changes, e.g. to an incremental GC? Yes, RAM can of course still get full.. but was this about accumulated garbage? [I only scanned thread.. Will not look into much if you think someone just forgot to close the issue.] @vtjnash: "Good garbage collection is a tradeoff of time and memory allocation. I recommend you save time and buy enough memory to contain your data." [Yes and no, garbage be allowed to accumulate to much for cache reasons, and you can't buy that easily, but it's a different issue to memory running out.] In the case stated, the memory didn't really run out. Does Julia ever return memory to the OS? Maybe allocated garbage memory, not used, isn't too big of a problem.. for the current process or for all combined, so I'm not too worried, on Android without VM, it would however be more of an issue. |
Close as dup of #17987. (Really the other way around but it's better to discuss there.) |
Refer to this example
https://groups.google.com/forum/#!topic/julia-users/eYCwT6o4UlM
A = a big matrix. After A is defined, there would be 1.1 GB free memory left
B = a random matrix of 500 MB
C = a random matrix of 500 MB
so now there's only 100 MB free on the memory
C = 0
still 100MB free.... Julia not cleaning up Memory. MATLAB would free the memory at this point
B = a random matrix of 500 MB
run out of RAM, now stuff get written to disk
This example was ran in Julia v0.2.1 on Mac OS 10.8.5.
The text was updated successfully, but these errors were encountered: