Skip to content
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

Free objects with finalizer more eagerly #13995

Merged
merged 3 commits into from
Jun 6, 2016
Merged

Conversation

yuyichao
Copy link
Contributor

@yuyichao yuyichao commented Nov 15, 2015

  • Run all the finalizers at the same time in a dead reference tree
  • Reset objects that are only reachable from finalizer list as young and clean
    so that they can be collect during next quick GC without being promoted to old gen.

@timholy Could you please check if this helps with the problem you have in JuliaGizmos/Reactive.jl#76 (comment) .

Closes #14127

@yuyichao
Copy link
Contributor Author

@carnaval

@yuyichao yuyichao added the GC Garbage collector label Nov 15, 2015
@yuyichao yuyichao force-pushed the yyc/gc/eager-finalize branch from 5d81e7b to 558070c Compare November 15, 2015 03:29
@timholy
Copy link
Member

timholy commented Nov 15, 2015

Very nice!

JuliaGizmos/Reactive.jl#76 (comment) suggests another source for the specific problem we were having.

@timholy
Copy link
Member

timholy commented Nov 25, 2015

On #14127 I get:

julia> gc()

julia> gc()
GC error (probable corruption) :
<?#0x7f2c6c2c4880::<?#0x7f2c6c2c4850::<?#0x7f2c6c2c4860::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::<?#0x7f2c6c205c10::•>>>>>>>>>>>>>>>>>>>>>>>>>>

signal (6): Aborted
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x7f2e6d8fe3fa)
jl_gc_collect at /home/tim/src/julia-0.5/usr/bin/../lib/libjulia.so (unknown line)
gc at base.jl:80
jlcall_gc_22732 at  (unknown line)
jl_apply_generic at /home/tim/src/julia-0.5/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 0x7f2e6d8cd0d3)
unknown function (ip: 0x7f2e6d8cc4c7)
unknown function (ip: 0x7f2e6d8e14d8)
jl_toplevel_eval_in_warn at /home/tim/src/julia-0.5/usr/bin/../lib/libjulia.so (unknown line)
eval at ./boot.jl:264
jl_apply_generic at /home/tim/src/julia-0.5/usr/bin/../lib/libjulia.so (unknown line)
eval_user_input at REPL.jl:3
jlcall_eval_user_input_22565 at  (unknown line)
jl_apply_generic at /home/tim/src/julia-0.5/usr/bin/../lib/libjulia.so (unknown line)
anonymous at REPL.jl:92
unknown function (ip: 0x7f2e6d8d3918)
unknown function (ip: (nil))
Aborted (core dumped)

@yuyichao yuyichao force-pushed the yyc/gc/eager-finalize branch from 558070c to f40ada0 Compare February 26, 2016 18:51
@yuyichao yuyichao force-pushed the yyc/gc/eager-finalize branch 13 times, most recently from 8484cbc to 9993f15 Compare February 28, 2016 08:05
@yuyichao yuyichao force-pushed the yyc/gc/eager-finalize branch from 9993f15 to 799119d Compare March 15, 2016 22:29
tanmaykm added a commit to tanmaykm/Blobs.jl that referenced this pull request Mar 17, 2016
- Checking weakref value to be null as an indicator of gc is not reliable. We probably need a finalizer for that, but all finalizers don't get called immediately at the moment (ref: JuliaLang/julia#13995). Going without that optimization for now.
- fixed an issue where cache eviction was corrupting the cache
@yuyichao yuyichao force-pushed the yyc/gc/eager-finalize branch 2 times, most recently from 9b50a64 to 3da6fe7 Compare April 3, 2016 20:56
@yuyichao yuyichao force-pushed the yyc/gc/eager-finalize branch from 3da6fe7 to f307483 Compare June 4, 2016 14:06
@@ -262,6 +264,12 @@ static size_t max_collect_interval = 500000000UL;

// global variables for GC stats

// Resetting the object to a young object, this is used when marking the
// finalizer list to collect them the next time because the object is very
// likely dead. This also won't break the GC invariance since these object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these objects

@yuyichao yuyichao force-pushed the yyc/gc/eager-finalize branch 2 times, most recently from 6dabec0 to 90a50d5 Compare June 4, 2016 14:58
@yuyichao
Copy link
Contributor Author

yuyichao commented Jun 4, 2016

So as @tkelman has already noticed, this is rebased on current master and the test is fixed to account for the inefficient GC root generation. The original worry that this can confuse page sweeping should also be fixed by #16632 so this should be ready to go after some GC stress tests.

@carnaval

yuyichao added 3 commits June 5, 2016 09:41
* Run all the finalizers at the same time in a dead reference tree
* Reset objects that are only reachable from finalizer list as young and
  clean so that they can be collect during next quick GC without being
  promoted to old gen.

Closes #14127
@yuyichao yuyichao force-pushed the yyc/gc/eager-finalize branch from 90a50d5 to 7042e36 Compare June 5, 2016 13:41
// Reset the age and old bit for any unmarked objects referenced by the
// `to_finalize` list. These objects are only reachable from this list
// and should not be referenced by any old objects so this won't break
// the GC invariant.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vtjnash Better?

@yuyichao yuyichao merged commit f4cb80b into master Jun 6, 2016
@yuyichao yuyichao deleted the yyc/gc/eager-finalize branch June 6, 2016 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GC Garbage collector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants