Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix the new capacity measurement in arenas.
For the given code paths, the amount of space used in the previous chunk
is irrelevant.

(This will almost never make a difference to behaviour, but it makes the
code clearer.)
  • Loading branch information
nnethercote committed May 13, 2020
commit 9111d8b66e013a881bae4e09646514be86ca4c87
4 changes: 2 additions & 2 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl<T> TypedArena<T> {
new_capacity = last_chunk.storage.capacity();
loop {
new_capacity = new_capacity.checked_mul(2).unwrap();
if new_capacity >= currently_used_cap + n {
if new_capacity >= n {
break;
}
}
Expand Down Expand Up @@ -350,7 +350,7 @@ impl DroplessArena {
new_capacity = last_chunk.storage.capacity();
loop {
new_capacity = new_capacity.checked_mul(2).unwrap();
if new_capacity >= used_bytes + needed_bytes {
if new_capacity >= needed_bytes {
break;
}
}
Expand Down