#4032 closed enhancement (fixed)

Make deferred free in malloc() support optional

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: lib Version: 6
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

The free() implementation in RTEMS supports that allocated memory is freed in interrupt context. Since the heap is protected by a mutex, the frees issued in interrupt context cannot immediately be freed to the heap, instead they are placed on a deferred free list. This list is emptied by the core allocation function rtems_heap_allocate_aligned_with_boundary(). This adds a dependency to free() in rtems_heap_allocate_aligned_with_boundary(). In order to better support applications which only allocate memory an never free it, this dependency should be avoided. This can be done with a weak default implementation of _Malloc_Process_deferred_frees(). In the free() module a strong implementation can be provided.

Change History (3)

comment:1 Changed on Jul 24, 2020 at 5:14:22 AM by Sebastian Huber <sebastian.huber@…>

In 6f94a83/rtems:

score: Add RTEMS_WEAK

Update #4032.

comment:2 Changed on Jul 24, 2020 at 5:14:26 AM by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In 7746b0de/rtems:

malloc: Make deferred free support optional

Only include the deferred free support if free() is actually used by the
application.

The free() implementation in RTEMS supports that allocated memory is
freed in interrupt context. Since the heap is protected by a mutex, the
frees issued in interrupt context cannot immediately be freed to the
heap, instead they are placed on a deferred free list. This list is
emptied by the core allocation function
rtems_heap_allocate_aligned_with_boundary(). This adds a dependency to
free() in rtems_heap_allocate_aligned_with_boundary(). In order to
better support applications which only allocate memory and never free
it, this dependency should be avoided. Provide a weak default
implementation of _Malloc_Process_deferred_frees() for
rtems_heap_allocate_aligned_with_boundary(). In the free() module
provide the strong implementation.

Close #4032.

comment:3 Changed on Jul 24, 2020 at 5:32:01 AM by Sebastian Huber <sebastian.huber@…>

In 4444094d/rtems:

spmisc01: Include missing header file

Update #4032.

Note: See TracTickets for help on using tickets.