Skip to content

Docs: add GC user docs #58733

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

IanButterworth
Copy link
Member

Closes #54565

Initially generated using Claude 4, with review and tidyup.

@d-netto or others on the GC team, please feel free to push to this directly.

@IanButterworth IanButterworth requested a review from d-netto June 14, 2025 21:56
@IanButterworth IanButterworth added docs This change adds or pertains to documentation GC Garbage collector backport 1.12 Change should be backported to release-1.12 labels Jun 14, 2025
@IanButterworth IanButterworth changed the title Docs: add GC docs Docs: add GC user docs Jun 14, 2025

By default, Julia uses multiple threads for garbage collection:

* **Mark threads**: Used during the mark phase to trace object references (default: same as compute threads (thread 1 is shared))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* **Mark threads**: Used during the mark phase to trace object references (default: same as compute threads (thread 1 is shared))
* **Mark threads**: Used during the mark phase to trace object references (default: 1, which is shared with the compute thread if there is only one, otherwise half the number of compute threads)

the nested parenthetical here reads a bit odd, and I'm not sure how to square the information with https://docs.julialang.org/en/v1/manual/multi-threading/#Multiple-GC-Threads stating that #mark threads = 1/2 #compute threads

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe the point I was trying to highlight isn't important, but the first gc mark thread is the same thread as thread 1.

% ./julia -t6 -q
julia> versioninfo()
...
Threads: 6 default, 1 interactive, 6 GC (on 6 virtual cores)

julia> Threads.maxthreadid()
12

(not 13)

I've been confused by that before. But maybe that's too niche.

Copy link
Member

Choose a reason for hiding this comment

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

now I'm confused even more 😁, if there are 6 worker threads and 6 GC threads, how is that "half the number of compute threads" ? are the original docs wrong?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right.. good point

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the default number of GC threads is now --threads.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. I added a docs fix, not not sure if I found every instance. It's a hard thing to search for.

IanButterworth and others added 3 commits June 17, 2025 09:42
Co-authored-by: Andy Dienes <51664769+adienes@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.12 Change should be backported to release-1.12 docs This change adds or pertains to documentation GC Garbage collector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GC could do with more consolidated intro user documentation
4 participants