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

Fix oom_error function argument #18

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

jipolanco
Copy link
Contributor

First of all, thanks for this really useful package!

I detected an issue in the latest (v0.3.0) version of Bumper.jl. The oom_error function is called with a single argument b::AllocBuffer in:

Bumper.jl/src/Bumper.jl

Lines 68 to 73 in 55d0ded

function alloc_ptr(b::AllocBuffer, sz::Int)
ptr = pointer(b) + b.offset
b.offset += sz
b.offset > sizeof(b.buf) && oom_error(b)
ptr
end

However, the only definition of oom_error takes no arguments:

Bumper.jl/src/Bumper.jl

Lines 82 to 85 in 55d0ded

@noinline function oom_error()
error("alloc: Buffer out of memory. This might be a sign of a memory leak.
Use Bumper.reset_buffer!() or Bumper.reset_buffer!(b::AllocBuffer) to reclaim its memory.")
end

Even in cases where the OOM error is never reached, this causes JET.jl to complain when analysing code which uses Bumper.jl.

This PR fixes the issue by including an unused positional argument to oom_error.

@MasonProtter
Copy link
Owner

Oh good catch, thank you!

I think I meant to make oom_error report how many bytes were allocated, but it's not really the most useful information so I think for now I'll leave it like this with the unused argument for now.

@MasonProtter MasonProtter merged commit 8441a69 into MasonProtter:main Oct 11, 2023
6 of 7 checks passed
@MasonProtter MasonProtter changed the title Fix oom_error function inconsistency Fix oom_error function argument Oct 11, 2023
@jipolanco jipolanco deleted the jip/oom-error branch October 14, 2024 08:26
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