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

Keep capacity sane when creating a bitmap with a capacity #499

Merged
merged 2 commits into from
Aug 5, 2023

Conversation

Dr-Emann
Copy link
Member

@Dr-Emann Dr-Emann commented Aug 5, 2023

The previous code would happily accept and create huge allocations (up to 22 GiB) for up to 2 billion containers. However, we know the maximum number of containers possible, so we instead clamp to that value.

This leads to two changes:

  • When requesting more than 2^16 containers, we will only allocate space for 2^16 containers
  • When requesting more than 2^31 containers, we will no longer error

The previous code would happily accept and create _huge_ allocations
(up to 22 GiB) for up to 2 billion containers. However, we know the maximum
number of containers possible, so we instead clamp to that value.

This leads to two changes:
- When requesting more than 2^16 containers, we will only allocate space for
  2^16 containers
- When requesting more than 2^31 containers, we will no longer error
@lemire lemire merged commit 9eb2a35 into RoaringBitmap:master Aug 5, 2023
25 checks passed
@lemire
Copy link
Member

lemire commented Aug 5, 2023

Merged.

@Dr-Emann Dr-Emann deleted the huge_capacity branch August 5, 2023 15:35
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