From f48aea09d8d82ab80568ad2edcd02b8a11bea886 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 4 May 2021 13:14:21 +0200 Subject: Mention zero size allocation changes --- rtems-notes-6.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/rtems-notes-6.md b/rtems-notes-6.md index cec71d0..39ebd29 100644 --- a/rtems-notes-6.md +++ b/rtems-notes-6.md @@ -39,7 +39,19 @@ Implementation improvements usually fall into one of the following categories: #### API Implementation Improvements -* TBD +* Zero size allocation results are now consistent accross directives, for + example `malloc( 0 )` and `posix_memalign( &p, align, 0 )` return now a + unique pointer (or `NULL` if the heap is empty). In POSIX, zero size memory + allocations are implementation-defined behaviour. The implementation has two + options: + + * https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html + + * https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html + + Linux and FreeBSD return a unique pointer for zero size memory allocations. + This approach is now also used in RTEMS as well throughout the memory + allocation directives #### API Deprecations -- cgit v1.2.3