<div dir="ltr">ok</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 26, 2021 at 8:11 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The first block must be a proper block.  Account for this in<br>
_Heap_Area_overhead().<br>
---<br>
 cpukit/include/rtems/score/heap.h | 8 +++++++-<br>
 1 file changed, 7 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/cpukit/include/rtems/score/heap.h b/cpukit/include/rtems/score/heap.h<br>
index ccc2f5c0fe..62a81cbad9 100644<br>
--- a/cpukit/include/rtems/score/heap.h<br>
+++ b/cpukit/include/rtems/score/heap.h<br>
@@ -455,7 +455,13 @@ RTEMS_INLINE_ROUTINE uintptr_t _Heap_Area_overhead(<br>
     page_size = CPU_ALIGNMENT;<br>
   }<br>
<br>
-  return 2 * (page_size - 1) + HEAP_BLOCK_HEADER_SIZE;<br>
+  /*<br>
+   * Account for a potential alignment of the area begin address to a page<br>
+   * boundary, the first block, and the last block.  The last block consists<br>
+   * only of a block header.<br>
+   */<br>
+  return page_size - 1 + _Heap_Min_block_size( page_size ) +<br>
+    HEAP_BLOCK_HEADER_SIZE;<br>
 }<br>
<br>
 /**<br>
-- <br>
2.26.2<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>