-
-
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
Garbage collection mystery #9415
Comments
Mutable types have to be heap allocated. Try changing |
Also, this kind of question is really more apt for the julia-users list than a GitHub issue, which is for specific bugs or features. |
Time spent doing GC is mostly not dictated by how much garbage is collected, but rather by how much heap-allocated memory must be scanned to check if it is garbage or not. You can do a GC pass and collect no garbage at all yet it will take a while. |
Point taken about the approperiate venue for this type of question, sorry about that, and thank for the quick answer :) After changing |
To expand a bit, the gc doesn't spend much time actually "destroying" things (arguably it is the fastest part of the work). Most of the time is spent walking the heap to see if anything needs to be destroyed. |
Ha, should have refreshed before submit. |
Ah, Ok, many thanks! |
Synopsis: Garbage collection is taking significant time, even when (I think) nothing is destroyed.
After loading the following code...
... and then running once to compile (not shown). I then run as follows:
There is a relatively large amount of time spent garbage collecting (approx 50%) . The first test shows that the bulk of the garbage collection happens neither upon the exit of
funC()
nor upon the exit oftestC()
since inside time, outside time, and elapsed time are practically identical. Therefore, it must be happening somewhere withinfunC()
. The second test shows that there is some remaining garbage collection possible after the exit oftestC()
(perhaps the arrayC
?), but that this is relatively small compared with the mystery amount that is happening elsewhere.My apologizes if I am missing something, but it seems to me that nothing should be destroyed until after
testC()
exits. If this is, in fact, expected behavior, then I would appreciate an explanation of what hidden local variables are being created and destroyed, and if there is any way to reduce this overhead.Replacing
Container
withFloat64
does not use nearly the same amount of garbage collection time, which may indicate that the problem has somehting to do with composite types, but I realize that the small size ofFloat64
vs.Container
also complicates the issue.I am using Julia 0.4.0-dev+2006 (2014-12-08 21:48 UTC)
Thanks for any feedback.
The text was updated successfully, but these errors were encountered: