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

backport memory pressure callback to 1.9 #114

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

d-netto
Copy link
Member

@d-netto d-netto commented Dec 6, 2023

PR Description

Backports the memory pressure callback to 1.9.

Requirements for merging:

  • I have opened an issue or PR upstream on JuliaLang/julia: Page based heap size heuristics JuliaLang/julia#50144
  • I have removed the port-to-* labels that don't apply.
  • I have opened a PR on raicode to test these changes: I believe it's not applicable, since we're not using it in raicode, but happy to introduce a few tests in raicode.

@github-actions github-actions bot added port-to-v1.10 This change should apply to Julia v1.10 builds port-to-master This change should apply to all future Julia builds port-to-v1.9 This change should apply to Julia v1.9 builds labels Dec 6, 2023
@d-netto d-netto removed the port-to-master This change should apply to all future Julia builds label Dec 13, 2023
@d-netto
Copy link
Member Author

d-netto commented Dec 13, 2023

MWE that should give some guidance on how to use:

using Printf

function mem_pressure_callback()
        @printf "memory pressure callback called\n"
end

callback_as_cfunction = @cfunction(mem_pressure_callback, Cvoid, ())

ccall(:jl_gc_set_cb_notify_gc_pressure, Cvoid, (Ptr{Cvoid}, Cint), callback_as_cfunction, true)

GC.gc()

Testing the callback with a low --heap-size-hint :

./julia --heap-size-hint=40k mwe.jl 
memory pressure callback called

--heap-size-hint=500M (or any large value) doesn't output anything, as expected.

@d-netto d-netto merged commit 4f8508d into v1.9.2+RAI Dec 13, 2023
1 check passed
@d-netto d-netto deleted the dcn-memory-pressure-callback branch December 13, 2023 16:38
@d-netto d-netto removed the port-to-v1.10 This change should apply to Julia v1.10 builds label Jan 2, 2024
d-netto added a commit that referenced this pull request Jan 2, 2024
@d-netto d-netto removed the port-to-v1.9 This change should apply to Julia v1.9 builds label Jan 2, 2024
d-netto added a commit that referenced this pull request Jan 2, 2024
DelveCI pushed a commit that referenced this pull request Jan 6, 2024
Drvi pushed a commit that referenced this pull request Jan 8, 2024
DelveCI pushed a commit that referenced this pull request Jan 13, 2024
DelveCI pushed a commit that referenced this pull request Jan 14, 2024
DelveCI pushed a commit that referenced this pull request Jan 15, 2024
DelveCI pushed a commit that referenced this pull request Jan 17, 2024
DelveCI pushed a commit that referenced this pull request Jan 18, 2024
DelveCI pushed a commit that referenced this pull request Jan 23, 2024
DelveCI pushed a commit that referenced this pull request Jan 24, 2024
DelveCI pushed a commit that referenced this pull request Jan 25, 2024
DelveCI pushed a commit that referenced this pull request Jan 27, 2024
DelveCI pushed a commit that referenced this pull request Jan 30, 2024
DelveCI pushed a commit that referenced this pull request Jan 31, 2024
DelveCI pushed a commit that referenced this pull request Feb 1, 2024
DelveCI pushed a commit that referenced this pull request Feb 6, 2024
DelveCI pushed a commit that referenced this pull request Feb 7, 2024
DelveCI pushed a commit that referenced this pull request Feb 14, 2024
DelveCI pushed a commit that referenced this pull request Feb 21, 2024
DelveCI pushed a commit that referenced this pull request Feb 22, 2024
Drvi pushed a commit that referenced this pull request Feb 28, 2024
DelveCI pushed a commit that referenced this pull request Mar 1, 2024
DelveCI pushed a commit that referenced this pull request Mar 13, 2024
Drvi pushed a commit that referenced this pull request Apr 3, 2024
d-netto added a commit that referenced this pull request Apr 16, 2024
DelveCI pushed a commit that referenced this pull request Apr 23, 2024
DelveCI pushed a commit that referenced this pull request Apr 24, 2024
DelveCI pushed a commit that referenced this pull request Apr 30, 2024
DelveCI pushed a commit that referenced this pull request Apr 30, 2024
DelveCI pushed a commit that referenced this pull request May 2, 2024
DelveCI pushed a commit that referenced this pull request May 9, 2024
DelveCI pushed a commit that referenced this pull request May 19, 2024
DelveCI pushed a commit that referenced this pull request May 26, 2024
DelveCI pushed a commit that referenced this pull request May 28, 2024
DelveCI pushed a commit that referenced this pull request May 29, 2024
Drvi pushed a commit that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants