[PATCH] heap: Fix _Heap_Area_overhead()
Gedare Bloom
gedare at rtems.org
Tue Jan 26 15:48:34 UTC 2021
ok
On Tue, Jan 26, 2021 at 8:11 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:
> The first block must be a proper block. Account for this in
> _Heap_Area_overhead().
> ---
> cpukit/include/rtems/score/heap.h | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/include/rtems/score/heap.h
> b/cpukit/include/rtems/score/heap.h
> index ccc2f5c0fe..62a81cbad9 100644
> --- a/cpukit/include/rtems/score/heap.h
> +++ b/cpukit/include/rtems/score/heap.h
> @@ -455,7 +455,13 @@ RTEMS_INLINE_ROUTINE uintptr_t _Heap_Area_overhead(
> page_size = CPU_ALIGNMENT;
> }
>
> - return 2 * (page_size - 1) + HEAP_BLOCK_HEADER_SIZE;
> + /*
> + * Account for a potential alignment of the area begin address to a page
> + * boundary, the first block, and the last block. The last block
> consists
> + * only of a block header.
> + */
> + return page_size - 1 + _Heap_Min_block_size( page_size ) +
> + HEAP_BLOCK_HEADER_SIZE;
> }
>
> /**
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210126/9862f511/attachment.html>
More information about the devel
mailing list