fitzgen / bumpalo

A fast bump allocation arena for Rust
https://docs.rs/bumpalo
Apache License 2.0
1.36k stars 111 forks source link

Fix alloc_slice_fill_zero on architectures where "max alignment" is only 4 (such as i386) #129

Closed plugwash closed 2 years ago

plugwash commented 2 years ago

The code in alloc_slice_fill_zero assumes that at least one out of u64 and String will have an alignment of 8. However that is not the case on all platforms in particular it is not the case on i386. On i386 the maximum alignment for regular types (I think some SSE stuff is an exception) is 4.

This PR replaces the fixed value 7 with a figure calculated from the actual alignment requirements of String and u64.