| 1 |
## Unreleased |
| 2 |
|
| 3 |
Released YYYY-MM-DD. |
| 4 |
|
| 5 |
### Added |
| 6 |
|
| 7 |
* TODO (or remove section if none) |
| 8 |
|
| 9 |
### Changed |
| 10 |
|
| 11 |
* TODO (or remove section if none) |
| 12 |
|
| 13 |
### Deprecated |
| 14 |
|
| 15 |
* TODO (or remove section if none) |
| 16 |
|
| 17 |
### Removed |
| 18 |
|
| 19 |
* TODO (or remove section if none) |
| 20 |
|
| 21 |
### Fixed |
| 22 |
|
| 23 |
* TODO (or remove section if none) |
| 24 |
|
| 25 |
### Security |
| 26 |
|
| 27 |
* TODO (or remove section if none) |
| 28 |
|
| 29 |
-------------------------------------------------------------------------------- |
| 30 |
|
| 31 |
## 3.16.0 |
| 32 |
|
| 33 |
Released 2024-04-08. |
| 34 |
|
| 35 |
### Added |
| 36 |
|
| 37 |
* Added an optional, off-by-default dependency on the `serde` crate. Enabling |
| 38 |
this dependency allows you to serialize Bumpalo's collection and box |
| 39 |
types. Deserialization is not implemented, due to constraints of the |
| 40 |
deserialization trait. |
| 41 |
|
| 42 |
-------------------------------------------------------------------------------- |
| 43 |
|
| 44 |
## 3.15.4 |
| 45 |
|
| 46 |
Released 2024-03-07. |
| 47 |
|
| 48 |
### Added |
| 49 |
|
| 50 |
* Added the `bumpalo::collections::Vec::extend_from_slices_copy` method, which |
| 51 |
is a faster way to extend a vec from multiple slices when the element is |
| 52 |
`Copy` than calling `extend_from_slice_copy` N times. |
| 53 |
|
| 54 |
-------------------------------------------------------------------------------- |
| 55 |
|
| 56 |
## 3.15.3 |
| 57 |
|
| 58 |
Released 2024-02-22. |
| 59 |
|
| 60 |
### Added |
| 61 |
|
| 62 |
* Added additional performance improvements to `bumpalo::collections::Vec` |
| 63 |
related to reserving capacity. |
| 64 |
|
| 65 |
-------------------------------------------------------------------------------- |
| 66 |
|
| 67 |
## 3.15.2 |
| 68 |
|
| 69 |
Released 2024-02-21. |
| 70 |
|
| 71 |
### Added |
| 72 |
|
| 73 |
* Add a `bumpalo::collections::Vec::extend_from_slice_copy` method. This doesn't |
| 74 |
exist on the standard library's `Vec` but they have access to specialization, |
| 75 |
so their regular `extend_from_slice` has a specialization for `Copy` |
| 76 |
types. Using this new method for `Copy` types is a ~80x performance |
| 77 |
improvement over the plain `extend_from_slice` method. |
| 78 |
|
| 79 |
-------------------------------------------------------------------------------- |
| 80 |
|
| 81 |
## 3.15.1 |
| 82 |
|
| 83 |
Released 2024-02-20. |
| 84 |
|
| 85 |
### Fixed |
| 86 |
|
| 87 |
* Fixed the MSRV listed in `Cargo.toml`, whose update was forgotten when the |
| 88 |
MSRV bumped in release 3.15.0. |
| 89 |
|
| 90 |
-------------------------------------------------------------------------------- |
| 91 |
|
| 92 |
## 3.15.0 |
| 93 |
|
| 94 |
Released 2024-02-15. |
| 95 |
|
| 96 |
### Changed |
| 97 |
|
| 98 |
* The minimum supported Rust version (MSRV) is now 1.73.0. |
| 99 |
* `bumpalo::collections::String::push_str` and |
| 100 |
`bumpalo::collections::String::from_str_in` received significant performance |
| 101 |
improvements. |
| 102 |
* Allocator trait methods are now marked `#[inline]`, increasing performance for |
| 103 |
some callers. |
| 104 |
|
| 105 |
### Fixed |
| 106 |
|
| 107 |
* Fixed an edge-case bug in the `Allocator::shrink` method. |
| 108 |
|
| 109 |
-------------------------------------------------------------------------------- |
| 110 |
|
| 111 |
## 3.14.0 |
| 112 |
|
| 113 |
Released 2023-09-14. |
| 114 |
|
| 115 |
### Added |
| 116 |
|
| 117 |
* Added the `std` cargo feature, which enables implementations of `std` traits |
| 118 |
for various things. Right now that is just `std::io::Write` for |
| 119 |
`bumpalo::collections::Vec`, but could be more in the future. |
| 120 |
|
| 121 |
-------------------------------------------------------------------------------- |
| 122 |
|
| 123 |
## 3.13.0 |
| 124 |
|
| 125 |
Released 2023-05-22. |
| 126 |
|
| 127 |
### Added |
| 128 |
|
| 129 |
* New `"allocator-api2"` feature enables the use of the allocator API on |
| 130 |
stable. This feature uses a crate that mirrors the API of the unstable Rust |
| 131 |
`allocator_api` feature. If the feature is enabled, references to `Bump` will |
| 132 |
implement `allocator_api2::Allocator`. This allows `Bump` to be used as an |
| 133 |
allocator for collection types from `allocator-api2` and any other crates that |
| 134 |
support `allocator-api2`. |
| 135 |
|
| 136 |
### Changed |
| 137 |
|
| 138 |
* The minimum supported Rust version (MSRV) is now 1.63.0. |
| 139 |
|
| 140 |
-------------------------------------------------------------------------------- |
| 141 |
|
| 142 |
## 3.12.2 |
| 143 |
|
| 144 |
Released 2023-05-09. |
| 145 |
|
| 146 |
### Changed |
| 147 |
|
| 148 |
* Added `rust-version` metadata to `Cargo.toml` which helps `cargo` with version |
| 149 |
resolution. |
| 150 |
|
| 151 |
-------------------------------------------------------------------------------- |
| 152 |
|
| 153 |
## 3.12.1 |
| 154 |
|
| 155 |
Released 2023-04-21. |
| 156 |
|
| 157 |
### Fixed |
| 158 |
|
| 159 |
* Fixed a bug where `Bump::try_with_capacity(n)` where `n > isize::MAX` could |
| 160 |
lead to attempts to create invalid `Layout`s. |
| 161 |
|
| 162 |
-------------------------------------------------------------------------------- |
| 163 |
|
| 164 |
## 3.12.0 |
| 165 |
|
| 166 |
Released 2023-01-17. |
| 167 |
|
| 168 |
### Added |
| 169 |
|
| 170 |
* Added the `bumpalo::boxed::Box::bump` and `bumpalo::collections::String::bump` |
| 171 |
getters to get the underlying `Bump` that a string or box was allocated into. |
| 172 |
|
| 173 |
### Changed |
| 174 |
|
| 175 |
* Some uses of `Box` that MIRI did not previously consider as UB are now |
| 176 |
reported as UB, and `bumpalo`'s internals have been adjusted to avoid the new |
| 177 |
UB. |
| 178 |
|
| 179 |
-------------------------------------------------------------------------------- |
| 180 |
|
| 181 |
## 3.11.1 |
| 182 |
|
| 183 |
Released 2022-10-18. |
| 184 |
|
| 185 |
### Security |
| 186 |
|
| 187 |
* Fixed a bug where when `std::vec::IntoIter` was ported to |
| 188 |
`bumpalo::collections::vec::IntoIter`, it didn't get its underlying `Bump`'s |
| 189 |
lifetime threaded through. This meant that `rustc` was not checking the |
| 190 |
borrows for `bumpalo::collections::IntoIter` and this could result in |
| 191 |
use-after-free bugs. |
| 192 |
|
| 193 |
-------------------------------------------------------------------------------- |
| 194 |
|
| 195 |
## 3.11.0 |
| 196 |
|
| 197 |
Released 2022-08-17. |
| 198 |
|
| 199 |
### Added |
| 200 |
|
| 201 |
* Added support for per-`Bump` allocation limits. These are enforced only in the |
| 202 |
slow path when allocating new chunks in the `Bump`, not in the bump allocation |
| 203 |
hot path, and therefore impose near zero overhead. |
| 204 |
* Added the `bumpalo::boxed::Box::into_inner` method. |
| 205 |
|
| 206 |
### Changed |
| 207 |
|
| 208 |
* Updated to Rust 2021 edition. |
| 209 |
* The minimum supported Rust version (MSRV) is now 1.56.0. |
| 210 |
|
| 211 |
-------------------------------------------------------------------------------- |
| 212 |
|
| 213 |
## 3.10.0 |
| 214 |
|
| 215 |
Released 2022-06-01. |
| 216 |
|
| 217 |
### Added |
| 218 |
|
| 219 |
* Implement `bumpalo::collections::FromIteratorIn` for `Option` and `Result`, |
| 220 |
just like `core` does for `FromIterator`. |
| 221 |
* Implement `bumpalo::collections::FromIteratorIn` for `bumpalo::boxed::Box<'a, |
| 222 |
[T]>`. |
| 223 |
* Added running tests under MIRI in CI for additional confidence in unsafe code. |
| 224 |
* Publicly exposed `bumpalo::collections::Vec::drain_filter` since the |
| 225 |
corresponding `std::vec::Vec` method has stabilized. |
| 226 |
|
| 227 |
### Changed |
| 228 |
|
| 229 |
* `Bump::new` will not allocate a backing chunk until the first allocation |
| 230 |
inside the bump arena now. |
| 231 |
|
| 232 |
### Fixed |
| 233 |
|
| 234 |
* Properly account for alignment changes when growing or shrinking an existing |
| 235 |
allocation. |
| 236 |
* Removed all internal integer-to-pointer casts, to play better with UB checkers |
| 237 |
like MIRI. |
| 238 |
|
| 239 |
-------------------------------------------------------------------------------- |
| 240 |
|
| 241 |
## 3.9.1 |
| 242 |
|
| 243 |
Released 2022-01-06. |
| 244 |
|
| 245 |
### Fixed |
| 246 |
|
| 247 |
* Fixed link to logo in docs and README.md |
| 248 |
|
| 249 |
-------------------------------------------------------------------------------- |
| 250 |
|
| 251 |
## 3.9.0 |
| 252 |
|
| 253 |
Released 2022-01-05. |
| 254 |
|
| 255 |
### Changed |
| 256 |
|
| 257 |
* The minimum supported Rust version (MSRV) has been raised to Rust 1.54.0. |
| 258 |
|
| 259 |
* `bumpalo::collections::Vec<T>` implements relevant traits for all arrays of |
| 260 |
any size `N` via const generics. Previously, it was just arrays up to length |
| 261 |
32. Similar for `bumpalo::boxed::Box<[T; N]>`. |
| 262 |
|
| 263 |
-------------------------------------------------------------------------------- |
| 264 |
|
| 265 |
## 3.8.0 |
| 266 |
|
| 267 |
Released 2021-10-19. |
| 268 |
|
| 269 |
### Added |
| 270 |
|
| 271 |
* Added the `CollectIn` and `FromIteratorIn` traits to make building a |
| 272 |
collection from an iterator easier. These new traits live in the |
| 273 |
`bumpalo::collections` module and are implemented by |
| 274 |
`bumpalo::collections::{String,Vec}`. |
| 275 |
|
| 276 |
* Added the `Bump::iter_allocated_chunks_raw` method, which is an `unsafe`, raw |
| 277 |
version of `Bump::iter_allocated_chunks`. The new method does not take an |
| 278 |
exclusive borrow of the `Bump` and yields raw pointer-and-length pairs for |
| 279 |
each chunk in the bump. It is the caller's responsibility to ensure that no |
| 280 |
allocation happens in the `Bump` while iterating over chunks and that there |
| 281 |
are no active borrows of allocated data if they want to turn any |
| 282 |
pointer-and-length pairs into slices. |
| 283 |
|
| 284 |
-------------------------------------------------------------------------------- |
| 285 |
|
| 286 |
## 3.7.1 |
| 287 |
|
| 288 |
Released 2021-09-17. |
| 289 |
|
| 290 |
### Changed |
| 291 |
|
| 292 |
* The packaged crate uploaded to crates.io when `bumpalo` is published is now |
| 293 |
smaller, thanks to excluding unnecessary files. |
| 294 |
|
| 295 |
-------------------------------------------------------------------------------- |
| 296 |
|
| 297 |
## 3.7.0 |
| 298 |
|
| 299 |
Released 2020-05-28. |
| 300 |
|
| 301 |
### Added |
| 302 |
|
| 303 |
* Added `Borrow` and `BorrowMut` trait implementations for |
| 304 |
`bumpalo::collections::Vec` and |
| 305 |
`bumpalo::collections::String`. [#108](https://github.com/fitzgen/bumpalo/pull/108) |
| 306 |
|
| 307 |
### Changed |
| 308 |
|
| 309 |
* When allocating a new chunk fails, don't immediately give up. Instead, try |
| 310 |
allocating a chunk that is half that size, and if that fails, then try half of |
| 311 |
*that* size, etc until either we successfully allocate a chunk or we fail to |
| 312 |
allocate the minimum chunk size and then finally give |
| 313 |
up. [#111](https://github.com/fitzgen/bumpalo/pull/111) |
| 314 |
|
| 315 |
-------------------------------------------------------------------------------- |
| 316 |
|
| 317 |
## 3.6.1 |
| 318 |
|
| 319 |
Released 2020-02-18. |
| 320 |
|
| 321 |
### Added |
| 322 |
|
| 323 |
* Improved performance of `Bump`'s `Allocator::grow_zeroed` trait method |
| 324 |
implementation. [#99](https://github.com/fitzgen/bumpalo/pull/99) |
| 325 |
|
| 326 |
-------------------------------------------------------------------------------- |
| 327 |
|
| 328 |
## 3.6.0 |
| 329 |
|
| 330 |
Released 2020-01-29. |
| 331 |
|
| 332 |
### Added |
| 333 |
|
| 334 |
* Added a few new flavors of allocation: |
| 335 |
|
| 336 |
* `try_alloc` for fallible, by-value allocation |
| 337 |
|
| 338 |
* `try_alloc_with` for fallible allocation with an infallible initializer |
| 339 |
function |
| 340 |
|
| 341 |
* `alloc_try_with` for infallible allocation with a fallible initializer |
| 342 |
function |
| 343 |
|
| 344 |
* `try_alloc_try_with` method for fallible allocation with a fallible |
| 345 |
initializer function |
| 346 |
|
| 347 |
We already have infallible, by-value allocation (`alloc`) and infallible |
| 348 |
allocation with an infallible initializer (`alloc_with`). With these new |
| 349 |
methods, we now have every combination covered. |
| 350 |
|
| 351 |
Thanks to [Tamme Schichler](https://github.com/Tamschi) for contributing these |
| 352 |
methods! |
| 353 |
|
| 354 |
-------------------------------------------------------------------------------- |
| 355 |
|
| 356 |
## 3.5.0 |
| 357 |
|
| 358 |
Released 2020-01-22. |
| 359 |
|
| 360 |
### Added |
| 361 |
|
| 362 |
* Added experimental, unstable support for the unstable, nightly Rust |
| 363 |
`allocator_api` feature. |
| 364 |
|
| 365 |
The `allocator_api` feature defines an `Allocator` trait and exposes custom |
| 366 |
allocators for `std` types. Bumpalo has a matching `allocator_api` cargo |
| 367 |
feature to enable implementing `Allocator` and using `Bump` with `std` |
| 368 |
collections. |
| 369 |
|
| 370 |
First, enable the `allocator_api` feature in your `Cargo.toml`: |
| 371 |
|
| 372 |
```toml |
| 373 |
[dependencies] |
| 374 |
bumpalo = { version = "3.5", features = ["allocator_api"] } |
| 375 |
``` |
| 376 |
|
| 377 |
Next, enable the `allocator_api` nightly Rust feature in your `src/lib.rs` or `src/main.rs`: |
| 378 |
|
| 379 |
```rust |
| 380 |
# #[cfg(feature = "allocator_api")] |
| 381 |
# { |
| 382 |
#![feature(allocator_api)] |
| 383 |
# } |
| 384 |
``` |
| 385 |
|
| 386 |
Finally, use `std` collections with `Bump`, so that their internal heap |
| 387 |
allocations are made within the given bump arena: |
| 388 |
|
| 389 |
``` |
| 390 |
# #![cfg_attr(feature = "allocator_api", feature(allocator_api))] |
| 391 |
# #[cfg(feature = "allocator_api")] |
| 392 |
# { |
| 393 |
#![feature(allocator_api)] |
| 394 |
use bumpalo::Bump; |
| 395 |
|
| 396 |
// Create a new bump arena. |
| 397 |
let bump = Bump::new(); |
| 398 |
|
| 399 |
// Create a `Vec` whose elements are allocated within the bump arena. |
| 400 |
let mut v = Vec::new_in(&bump); |
| 401 |
v.push(0); |
| 402 |
v.push(1); |
| 403 |
v.push(2); |
| 404 |
# } |
| 405 |
``` |
| 406 |
|
| 407 |
I'm very excited to see custom allocators in `std` coming along! Thanks to |
| 408 |
Arthur Gautier for implementing support for the `allocator_api` feature for |
| 409 |
Bumpalo. |
| 410 |
|
| 411 |
-------------------------------------------------------------------------------- |
| 412 |
|
| 413 |
## 3.4.0 |
| 414 |
|
| 415 |
Released 2020-06-01. |
| 416 |
|
| 417 |
### Added |
| 418 |
|
| 419 |
* Added the `bumpalo::boxed::Box<T>` type. It is an owned pointer referencing a |
| 420 |
bump-allocated value, and it runs `T`'s `Drop` implementation on the |
| 421 |
referenced value when dropped. This type can be used by enabling the `"boxed"` |
| 422 |
cargo feature flag. |
| 423 |
|
| 424 |
-------------------------------------------------------------------------------- |
| 425 |
|
| 426 |
## 3.3.0 |
| 427 |
|
| 428 |
Released 2020-05-13. |
| 429 |
|
| 430 |
### Added |
| 431 |
|
| 432 |
* Added fallible allocation methods to `Bump`: `try_new`, `try_with_capacity`, |
| 433 |
and `try_alloc_layout`. |
| 434 |
|
| 435 |
* Added `Bump::chunk_capacity` |
| 436 |
|
| 437 |
* Added `bumpalo::collections::Vec::try_reserve[_exact]` |
| 438 |
|
| 439 |
-------------------------------------------------------------------------------- |
| 440 |
|
| 441 |
## 3.2.1 |
| 442 |
|
| 443 |
Released 2020-03-24. |
| 444 |
|
| 445 |
### Security |
| 446 |
|
| 447 |
* When `realloc`ing, if we allocate new space, we need to copy the old |
| 448 |
allocation's bytes into the new space. There are `old_size` number of bytes in |
| 449 |
the old allocation, but we were accidentally copying `new_size` number of |
| 450 |
bytes, which could lead to copying bytes into the realloc'd space from past |
| 451 |
the chunk that we're bump allocating out of, from unknown memory. |
| 452 |
|
| 453 |
If an attacker can cause `realloc`s, and can read the `realoc`ed data back, |
| 454 |
this could allow them to read things from other regions of memory that they |
| 455 |
shouldn't be able to. For example, if some crypto keys happened to live in |
| 456 |
memory right after a chunk we were bump allocating out of, this could allow |
| 457 |
the attacker to read the crypto keys. |
| 458 |
|
| 459 |
Beyond just fixing the bug and adding a regression test, I've also taken two |
| 460 |
additional steps: |
| 461 |
|
| 462 |
1. While we were already running the testsuite under `valgrind` in CI, because |
| 463 |
`valgrind` exits with the same code that the program did, if there are |
| 464 |
invalid reads/writes that happen not to trigger a segfault, the program can |
| 465 |
still exit OK and we will be none the wiser. I've enabled the |
| 466 |
`--error-exitcode=1` flag for `valgrind` in CI so that tests eagerly fail |
| 467 |
in these scenarios. |
| 468 |
|
| 469 |
2. I've written a quickcheck test to exercise `realloc`. Without the bug fix |
| 470 |
in this patch, this quickcheck immediately triggers invalid reads when run |
| 471 |
under `valgrind`. We didn't previously have quickchecks that exercised |
| 472 |
`realloc` because `realloc` isn't publicly exposed directly, and instead |
| 473 |
can only be indirectly called. This new quickcheck test exercises `realloc` |
| 474 |
via `bumpalo::collections::Vec::resize` and |
| 475 |
`bumpalo::collections::Vec::shrink_to_fit` calls. |
| 476 |
|
| 477 |
This bug was introduced in version 3.0.0. |
| 478 |
|
| 479 |
See [#69](https://github.com/fitzgen/bumpalo/issues/69) for details. |
| 480 |
|
| 481 |
-------------------------------------------------------------------------------- |
| 482 |
|
| 483 |
## 3.2.0 |
| 484 |
|
| 485 |
Released 2020-02-07. |
| 486 |
|
| 487 |
### Added |
| 488 |
|
| 489 |
* Added the `bumpalo::collections::Vec::into_bump_slice_mut` method to turn a |
| 490 |
`bumpalo::collections::Vec<'bump, T>` into a `&'bump mut [T]`. |
| 491 |
|
| 492 |
-------------------------------------------------------------------------------- |
| 493 |
|
| 494 |
## 3.1.2 |
| 495 |
|
| 496 |
Released 2020-01-07. |
| 497 |
|
| 498 |
### Fixed |
| 499 |
|
| 500 |
* The `bumpalo::collections::format!` macro did not used to accept a trailing |
| 501 |
comma like `format!(in bump; "{}", 1,)`, but it does now. |
| 502 |
|
| 503 |
-------------------------------------------------------------------------------- |
| 504 |
|
| 505 |
## 3.1.1 |
| 506 |
|
| 507 |
Released 2020-01-03. |
| 508 |
|
| 509 |
### Fixed |
| 510 |
|
| 511 |
* The `bumpalo::collections::vec!` macro did not used to accept a trailing |
| 512 |
comma like `vec![in bump; 1, 2,]`, but it does now. |
| 513 |
|
| 514 |
-------------------------------------------------------------------------------- |
| 515 |
|
| 516 |
## 3.1.0 |
| 517 |
|
| 518 |
Released 2019-12-27. |
| 519 |
|
| 520 |
### Added |
| 521 |
|
| 522 |
* Added the `Bump::allocated_bytes` diagnostic method for counting the total |
| 523 |
number of bytes a `Bump` has allocated. |
| 524 |
|
| 525 |
-------------------------------------------------------------------------------- |
| 526 |
|
| 527 |
# 3.0.0 |
| 528 |
|
| 529 |
Released 2019-12-20. |
| 530 |
|
| 531 |
## Added |
| 532 |
|
| 533 |
* Added `Bump::alloc_str` for copying string slices into a `Bump`. |
| 534 |
|
| 535 |
* Added `Bump::alloc_slice_copy` and `Bump::alloc_slice_clone` for copying or |
| 536 |
cloning slices into a `Bump`. |
| 537 |
|
| 538 |
* Added `Bump::alloc_slice_fill_iter` for allocating a slice in the `Bump` from |
| 539 |
an iterator. |
| 540 |
|
| 541 |
* Added `Bump::alloc_slice_fill_copy` and `Bump::alloc_slice_fill_clone` for |
| 542 |
creating slices of length `n` that are filled with copies or clones of an |
| 543 |
initial element. |
| 544 |
|
| 545 |
* Added `Bump::alloc_slice_fill_default` for creating slices of length `n` with |
| 546 |
the element type's default instance. |
| 547 |
|
| 548 |
* Added `Bump::alloc_slice_fill_with` for creating slices of length `n` whose |
| 549 |
elements are initialized with a function or closure. |
| 550 |
|
| 551 |
* Added `Bump::iter_allocated_chunks` as a replacement for the old |
| 552 |
`Bump::each_allocated_chunk`. The `iter_allocated_chunks` version returns an |
| 553 |
iterator, which is more idiomatic than its old, callback-taking counterpart. |
| 554 |
Additionally, `iter_allocated_chunks` exposes the chunks as `MaybeUninit`s |
| 555 |
instead of slices, which makes it usable in more situations without triggering |
| 556 |
undefined behavior. See also the note about bump direction in the "changed" |
| 557 |
section; if you're iterating chunks, you're likely affected by that change! |
| 558 |
|
| 559 |
* Added `Bump::with_capacity` so that you can pre-allocate a chunk with the |
| 560 |
requested space. |
| 561 |
|
| 562 |
### Changed |
| 563 |
|
| 564 |
* **BREAKING:** The direction we allocate within a chunk has changed. It used to |
| 565 |
be "upwards", from low addresses within a chunk towards high addresses. It is |
| 566 |
now "downwards", from high addresses towards lower addresses. |
| 567 |
|
| 568 |
Additionally, the order in which we iterate over allocated chunks has changed! |
| 569 |
We used to iterate over chunks from oldest chunk to youngest chunk, and now we |
| 570 |
do the opposite: the youngest chunks are iterated over first, and the oldest |
| 571 |
chunks are iterated over last. |
| 572 |
|
| 573 |
If you were using `Bump::each_allocated_chunk` to iterate over data that you |
| 574 |
had previously allocated, and *you want to iterate in order of |
| 575 |
oldest-to-youngest allocation*, you need to reverse the chunks iterator and |
| 576 |
also reverse the order in which you loop through the data within a chunk! |
| 577 |
|
| 578 |
For example, if you had this code: |
| 579 |
|
| 580 |
```rust |
| 581 |
unsafe { |
| 582 |
bump.each_allocated_chunk(|chunk| { |
| 583 |
for byte in chunk { |
| 584 |
// Touch each byte in oldest-to-youngest allocation order... |
| 585 |
} |
| 586 |
}); |
| 587 |
} |
| 588 |
``` |
| 589 |
|
| 590 |
It should become this code: |
| 591 |
|
| 592 |
```rust |
| 593 |
let mut chunks: Vec<_> = bump.iter_allocated_chunks().collect(); |
| 594 |
chunks.reverse(); |
| 595 |
for chunk in chunks { |
| 596 |
for byte in chunk.iter().rev() { |
| 597 |
let byte = unsafe { byte.assume_init() }; |
| 598 |
// Touch each byte in oldest-to-youngest allocation order... |
| 599 |
} |
| 600 |
} |
| 601 |
``` |
| 602 |
|
| 603 |
The good news is that this change yielded a *speed up in allocation throughput |
| 604 |
of 3-19%!* |
| 605 |
|
| 606 |
See https://github.com/fitzgen/bumpalo/pull/37 and |
| 607 |
https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html for details. |
| 608 |
|
| 609 |
* **BREAKING:** The `collections` cargo feature is no longer on by default. You |
| 610 |
must explicitly turn it on if you intend to use the `bumpalo::collections` |
| 611 |
module. |
| 612 |
|
| 613 |
* `Bump::reset` will now retain only the last allocated chunk (the biggest), |
| 614 |
rather than only the first allocated chunk (the smallest). This should enable |
| 615 |
`Bump` to better adapt to workload sizes and quickly reach a steady state |
| 616 |
where new chunks are not requested from the global allocator. |
| 617 |
|
| 618 |
### Removed |
| 619 |
|
| 620 |
* The `Bump::each_allocated_chunk` method is removed in favor of |
| 621 |
`Bump::iter_allocated_chunks`. Note that its safety requirements for reading |
| 622 |
from the allocated chunks are slightly different from the old |
| 623 |
`each_allocated_chunk`: only up to 16-byte alignment is supported now. If you |
| 624 |
allocate anything with greater alignment than that into the bump arena, there |
| 625 |
might be uninitialized padding inserted in the chunks, and therefore it is no |
| 626 |
longer safe to read them via `MaybeUninit::assume_init`. See also the note |
| 627 |
about bump direction in the "changed" section; if you're iterating chunks, |
| 628 |
you're likely affected by that change! |
| 629 |
|
| 630 |
* The `std` cargo feature has been removed, since this crate is now always |
| 631 |
no-std. |
| 632 |
|
| 633 |
## Fixed |
| 634 |
|
| 635 |
* Fixed a bug involving potential integer overflows with large requested |
| 636 |
allocation sizes. |
| 637 |
|
| 638 |
-------------------------------------------------------------------------------- |
| 639 |
|
| 640 |
# 2.6.0 |
| 641 |
|
| 642 |
Released 2019-08-19. |
| 643 |
|
| 644 |
* Implement `Send` for `Bump`. |
| 645 |
|
| 646 |
-------------------------------------------------------------------------------- |
| 647 |
|
| 648 |
# 2.5.0 |
| 649 |
|
| 650 |
Released 2019-07-01. |
| 651 |
|
| 652 |
* Add `alloc_slice_copy` and `alloc_slice_clone` methods that allocate space for |
| 653 |
slices and either copy (with bound `T: Copy`) or clone (with bound `T: Clone`) |
| 654 |
the provided slice's data into the newly allocated space. |
| 655 |
|
| 656 |
-------------------------------------------------------------------------------- |
| 657 |
|
| 658 |
# 2.4.3 |
| 659 |
|
| 660 |
Released 2019-05-20. |
| 661 |
|
| 662 |
* Fixed a bug where chunks were always deallocated with the default chunk |
| 663 |
layout, not the layout that the chunk was actually allocated with (i.e. if we |
| 664 |
started growing larger chunks with larger layouts, we would deallocate those |
| 665 |
chunks with an incorrect layout). |
| 666 |
|
| 667 |
-------------------------------------------------------------------------------- |
| 668 |
|
| 669 |
# 2.4.2 |
| 670 |
|
| 671 |
Released 2019-05-17. |
| 672 |
|
| 673 |
* Added an implementation `Default` for `Bump`. |
| 674 |
* Made it so that if bump allocation within a chunk overflows, we still try to |
| 675 |
allocate a new chunk to bump out of for the requested allocation. This can |
| 676 |
avoid some OOMs in scenarios where the chunk we are currently allocating out |
| 677 |
of is very near the high end of the address space, and there is still |
| 678 |
available address space lower down for new chunks. |
| 679 |
|
| 680 |
-------------------------------------------------------------------------------- |
| 681 |
|
| 682 |
# 2.4.1 |
| 683 |
|
| 684 |
Released 2019-04-19. |
| 685 |
|
| 686 |
* Added readme metadata to Cargo.toml so it shows up on crates.io |
| 687 |
|
| 688 |
-------------------------------------------------------------------------------- |
| 689 |
|
| 690 |
# 2.4.0 |
| 691 |
|
| 692 |
Released 2019-04-19. |
| 693 |
|
| 694 |
* Added support for `realloc`ing in-place when the pointer being `realloc`ed is |
| 695 |
the last allocation made from the bump arena. This should speed up various |
| 696 |
`String`, `Vec`, and `format!` operations in many cases. |
| 697 |
|
| 698 |
-------------------------------------------------------------------------------- |
| 699 |
|
| 700 |
# 2.3.0 |
| 701 |
|
| 702 |
Released 2019-03-26. |
| 703 |
|
| 704 |
* Add the `alloc_with` method, that (usually) avoids stack-allocating the |
| 705 |
allocated value and then moving it into the bump arena. This avoids potential |
| 706 |
stack overflows in release mode when allocating very large objects, and also |
| 707 |
some `memcpy` calls. This is similar to the `copyless` crate. Read [the |
| 708 |
`alloc_with` doc comments][alloc-with-doc-comments] and [the original issue |
| 709 |
proposing this API][issue-proposing-alloc-with] for more. |
| 710 |
|
| 711 |
[alloc-with-doc-comments]: https://github.com/fitzgen/bumpalo/blob/9f47aee8a6839ba65c073b9ad5372aacbbd02352/src/lib.rs#L436-L475 |
| 712 |
[issue-proposing-alloc-with]: https://github.com/fitzgen/bumpalo/issues/10 |
| 713 |
|
| 714 |
-------------------------------------------------------------------------------- |
| 715 |
|
| 716 |
# 2.2.2 |
| 717 |
|
| 718 |
Released 2019-03-18. |
| 719 |
|
| 720 |
* Fix a regression from 2.2.1 where chunks were not always aligned to the chunk |
| 721 |
footer's alignment. |
| 722 |
|
| 723 |
-------------------------------------------------------------------------------- |
| 724 |
|
| 725 |
# 2.2.1 |
| 726 |
|
| 727 |
Released 2019-03-18. |
| 728 |
|
| 729 |
* Fix a regression in 2.2.0 where newly allocated bump chunks could fail to have |
| 730 |
capacity for a large requested bump allocation in some corner cases. |
| 731 |
|
| 732 |
-------------------------------------------------------------------------------- |
| 733 |
|
| 734 |
# 2.2.0 |
| 735 |
|
| 736 |
Released 2019-03-15. |
| 737 |
|
| 738 |
* Chunks in an arena now start out small, and double in size as more chunks are |
| 739 |
requested. |
| 740 |
|
| 741 |
-------------------------------------------------------------------------------- |
| 742 |
|
| 743 |
# 2.1.0 |
| 744 |
|
| 745 |
Released 2019-02-12. |
| 746 |
|
| 747 |
* Added the `into_bump_slice` method on `bumpalo::collections::Vec<T>`. |
| 748 |
|
| 749 |
-------------------------------------------------------------------------------- |
| 750 |
|
| 751 |
# 2.0.0 |
| 752 |
|
| 753 |
Released 2019-02-11. |
| 754 |
|
| 755 |
* Removed the `BumpAllocSafe` trait. |
| 756 |
* Correctly detect overflows from large allocations and panic. |
| 757 |
|
| 758 |
-------------------------------------------------------------------------------- |
| 759 |
|
| 760 |
# 1.2.0 |
| 761 |
|
| 762 |
Released 2019-01-15. |
| 763 |
|
| 764 |
* Fixed an overly-aggressive `debug_assert!` that had false positives. |
| 765 |
* Ported to Rust 2018 edition. |
| 766 |
|
| 767 |
-------------------------------------------------------------------------------- |
| 768 |
|
| 769 |
# 1.1.0 |
| 770 |
|
| 771 |
Released 2018-11-28. |
| 772 |
|
| 773 |
* Added the `collections` module, which contains ports of `std`'s collection |
| 774 |
types that are compatible with backing their storage in `Bump` arenas. |
| 775 |
* Lifted the limits on size and alignment of allocations. |
| 776 |
|
| 777 |
-------------------------------------------------------------------------------- |
| 778 |
|
| 779 |
# 1.0.2 |
| 780 |
|
| 781 |
-------------------------------------------------------------------------------- |
| 782 |
|
| 783 |
# 1.0.1 |
| 784 |
|
| 785 |
-------------------------------------------------------------------------------- |
| 786 |
|
| 787 |
# 1.0.0 |