-
-
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
finalizer is not being called for some REPL objects #10960
Comments
|
I can reproduce the issue above on 0.4, but the finalizer appears to be called correctly on 0.3: julia> f=Foo(1)
Foo(1)
julia> f=1
1
julia> gc()
FINALIZED!!! |
Not a GC problem. The object is staying in the task local "SHOWN_SET", whatever this is used for. |
Hmm, you are right. Defining a I added
to the end of Lines 7 to 54 in e9fa25b
:SHOWNSET is an ObjectIdDict .
How did you figure that the object is staying in the task local SHOWNSET? |
ha this is a funny one. Turns out our eqtable implementation on which OIDict relies does not clear the pointer to the key when you delete an item. Looks like a one line fix, I'll push that. To answer your question : unfortunately it's not very user friendly. I went into gdb and watched the type tag of the object when it is gced. At the point it is being marked the stack trace is essentially a "ground truth" explanation of why it is being kept alive. We could have an actual tool for this but I won't have time to work on it any time soon. |
Hum. It seems that nulling the key pointer leads to some pretty deep corruption. Someone somewhere must be relying on the bug. |
Nevermind it was my bad. This should fix it. |
Thanks. |
Nice, @carnaval! |
This is a nice fix! |
Is there any way to test this? Can REPL sessions be tested somehow? |
No need for repl session. Just put something with a finalizer as an ObjectIdDict key and delete! the entry. |
Should this be backported to 0.3? |
#10960 (comment) seems to indicate it's not a problem there? |
Yeah, I'm trying to track down a memory leak in |
If executed in a single line, the finalizer is called.
On separate lines, it is not.
Came across this while debugging "leaks" in some parallel computation scenarios - turns out that the finalizer on
RemoteRef
objects is not being called in a consistent manner.The text was updated successfully, but these errors were encountered: