RTEMS | Add TLSF allocator implementation to RTEMS (#5633)

mazen Adel (@mez3n) gitlab at rtems.org
Thu Aug 6 02:16:00 UTC 2026




mazen Adel commented: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5633#note_156480


It should be noted that I was able to reuse only two algorithm-independent helper functions from the existing RTEMS Heap Handler: \_Heap_Align_down() and \_Heap_Align_up().

Reusing additional helpers was difficult for two main reasons. First, TLSF and first-fit use different blockdata and flags. TLSF stores an additional flag indicating whether the current block is used, However first-fit gets this information from the next block. Changing this is possible, but it would require modifications to the TLSF logic.

I modified the TLSF block structure so that its physical layout matches the first-fit block structure when heap protection is disabled. However, I have not yet replaced Heap_Tlsf_Block with Heap_Block. If the remaining metadata and header differences are handled, TLSF could reuse at least three additional helpers: 

* \_Heap_Block_at() instead of \_Heap_Tlsf_Block_at().
* \_Heap_Prev_block() instead of \_Heap_Tlsf_Block_prev().
* \_Heap_Alloc_area_of_block() instead of \_Heap_Tlsf_Block_to_ptr().

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5633#note_156480
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/5-bj3r51zsobzkdznq4p9kxh43u-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260806/0029f85d/attachment.htm>


More information about the bugs mailing list