[RTEMS Project] #4390: Make zero size allocation result consistent across directives

RTEMS trac trac at rtems.org
Tue May 4 11:08:11 UTC 2021


#4390: Make zero size allocation result consistent across directives
-----------------------------+------------------------------
 Reporter:  Sebastian Huber  |       Owner:  Sebastian Huber
     Type:  enhancement      |      Status:  closed
 Priority:  normal           |   Milestone:  6.1
Component:  admin            |     Version:  6
 Severity:  normal           |  Resolution:  fixed
 Keywords:                   |  Blocked By:
 Blocking:                   |
-----------------------------+------------------------------
Changes (by Sebastian Huber <sebastian.huber@…>):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"d692c62dfbf834c16ef7f171ea3161b3f3fac06b/rtems"
 d692c62d/rtems]:
 {{{
 #!CommitTicketReference repository="rtems"
 revision="d692c62dfbf834c16ef7f171ea3161b3f3fac06b"
 Make zero size allocation result consistent

 The zero size allocations had no consistent behaviour in RTEMS.  For
 example, malloc( 0 ) returned NULL and posix_memalign( &p, align, 0 )
 returned in p a unique pointer (or NULL if no memory is available).  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.   Use this approach for RTEMS as well throughout the memory
 allocation directives

 Close #4390.
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/4390#comment:4>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list