commit | cd15ca3178ec45ef6cc27453326004d102c8dc4c | [log] [tgz] |
---|---|---|
author | Aaron Green <aarongreen@google.com> | Tue May 21 22:50:09 2024 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue May 21 22:50:09 2024 +0000 |
tree | b2d9a58eaa6ef55d0a1b0d37b233ecb7bf5d34e7 | |
parent | cae40e3337b2234b2618cd506ecbb089c25a4e40 [diff] |
pw_allocator: Track requested sizes in blocks Previously, TrackingAllocator allocated extra space to store the requested layout when it was requested to be tracked. This allowed it to work with any allocator, but prevented the allocators it wrapped from being able to make any adjustments to allocations, e.g. for fragmentation purposes. Moreover, all the usages of Block designed to address more than 64K of memory are already wasting 2 bytes, since the offset type would be at least 4 bytes, and the "info" field only 2. Finally, the difference between the requested and allocated sizes are guaranteed to be less than a block overhead, which is much less than 64K. As a result, this CL: * Stores the excess bytes in a uint16_t "padding" field. * Implements GetRequestLayout for block allocators using that padding. * Simplifies TrackingAllocator by only support request_bytes metrics for allocators that implement GetRequestLayout. Change-Id: I0303667afeadf90a8f44cd8866fb1adbf8f8b6d6 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/210395 Reviewed-by: Taylor Cramer <cramertj@google.com> Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com> Reviewed-by: Keir Mierle <keir@google.com> Commit-Queue: Aaron Green <aarongreen@google.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.