collections: Fix example allocator#206
Merged
bors[bot] merged 1 commit intorust-embedded:masterfrom Apr 26, 2020
Merged
Conversation
The example bump-pointer allocator doesn't take into account the size of the allocation, just the alignment. As a result it'll work fine for small allocations where alignment >= size (e.g. a single int), but it results in overlapping allocations for anything larger. Also, change the alignment calculation to find the aligment using the add-then-mask method rather than screwing around with remainders. Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @korken89 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
jamesmunns
approved these changes
Apr 26, 2020
Member
jamesmunns
left a comment
There was a problem hiding this comment.
Looks good, thanks!
bors r+
Contributor
|
Build succeeded: |
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Apr 28, 2020
Update books ## nomicon 5 commits in 6eb24d6e9c0773d4aee68ed5fca121ce3cdf676a..4d2d275997746d35eabfc4d992dfbdcce2f626ed 2020-04-06 02:21:15 +0200 to 2020-04-27 10:24:52 -0400 - Fix example in FFI, section NPO - Update implementation code of `split_at_mut` - Use rust-lang/rust linkchecker on CI. - Use just `std::_` instead of `::std::_` - Remove illegal space. ## reference 2 commits in 3ce94ca..ed22e6fbfcb6ce436e9ea3b4bb4a55b2fb50a57e 2020-04-11 17:00:27 +0200 to 2020-04-24 12:46:22 -0700 - Fix grammer for tuple patterns and tuple struct patterns (rust-lang/reference#794) - Document drop scopes (rust-lang/reference#514) ## book 2 commits in f5db319e0b19c22964398d56bc63103d669e1bba..e37c0e84e2ef73d3a4ebffda8011db6814a3b02d 2020-04-13 08:06:03 -0500 to 2020-04-26 09:31:36 -0500 - Mention short-circuiting in Appendix 02 (rust-lang/book#2318) - Increase HTTP buffer size and add 'Content-Length' header (rust-lang/book#2246) ## rust-by-example 8 commits in c106d1683c3a2b0960f0f0fb01728cbb19807332..ffc99581689fe2455908aaef5f5cf50dd03bb8f5 2020-04-09 09:14:39 -0300 to 2020-04-24 15:05:04 -0300 - Fix Example -> Examples (rust-lang/rust-by-example#1340) - Make unsuffixed literal plural (rust-lang/rust-by-example#1335) - Ensure example error matches the comment (rust-lang/rust-by-example#1336) - Add missing triple backticks (rust-lang/rust-by-example#1339) - Clarify conditional compilation (rust-lang/rust-by-example#1338) - Clarifies how to customize lib crate name (rust-lang/rust-by-example#1337) - Fix bytes of youkoso in shiftjis (rust-lang/rust-by-example#1333) - Fix possible typo (rust-lang/rust-by-example#1334) ## embedded-book 4 commits in 668fb07b6160b9c468f598e839c1e044db65de30..40beccdf1bb8eb9184a2e3b42db8b8c6e394247f 2020-04-13 12:38:16 +0000 to 2020-04-26 17:44:14 +0000 - Add hint on memory config to GDB debugging section (rust-embedded/book#215) - Adds cargo-generate to installation instructions (rust-embedded/book#213) - collections: Fix example allocator (rust-embedded/book#206) - Flip111/patch 8 (rust-embedded/book#233)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The example bump-pointer allocator doesn't take into account the size of
the allocation, just the alignment. As a result it'll work fine for small
allocations where alignment >= size (e.g. a single int), but it results in
overlapping allocations for anything larger.
Also, change the alignment calculation to find the aligment using the
add-then-mask method rather than screwing around with remainders.
Signed-off-by: Oliver O'Halloran oohall@gmail.com