#1747 closed defect (fixed)

Heap extend allows discontinuous memory regions.

Reported by: Chris Johns Owned by: Sebastian Huber
Priority: low Milestone: 5.1
Component: score Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:

Description (last modified by Sebastian Huber)

The check in (cpukit/ChangeLog) states:

2010-06-07 Sebastian Huber <sebastian.huber@…>

  • score/src/heapextend.c: Implemented support for scattered heap areas.

The heap cannot support scattered blocks because the _Heap_Is_block_in_heap assumes the region is continuous between the first and last blocks of the heap. Making the gaps in the regions passed to the heap extend call used is questionable and makes the _Heap_Is_block_in_heap test not really perform the task it's name states. This is an issue because it is this check that determines if a heap free of NULL should proceed. This issue is covered in another PR.

I also wonder about a heap free call to an address that maps to one of the "in-use" gap regions. The previous heap code knew if an address was in the heap and therefore it was kind of safe to probe for a valid block. This assumption is now not valid.

The former heap extend code:


clearly states the type of memory that can be added to an existing heap. The current code has no restrictions. The user manual is not great in this area. It would also be useful if comments are added to the heap extend code.

The heap extend code is used by the rtems_region_extend call and this call clearly states in the manual that the memory region must be continuous. If this has changed we should discuss the API change and make better note of it. I also suspect the testsuite will need additions to test any API changes.

Change History (11)

comment:1 Changed on Mar 1, 2011 at 7:46:28 AM by Sebastian Huber

The support for scattered heap area does no harm for users of the continuous case. Only if you use the flexibility of a scattered heap area you have to life with a less effective _Heap_Is_block_in_heap() check.

comment:2 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:3 Changed on Nov 27, 2014 at 12:59:46 PM by Sebastian Huber

Description: modified (diff)

Where in the documentation should this heap extension stuff be mentioned?

comment:4 Changed on Feb 18, 2015 at 2:37:17 PM by Sebastian Huber

Description: modified (diff)
Status: newaccepted

comment:5 Changed on Mar 2, 2015 at 8:42:45 PM by Gedare Bloom


bump milestone

comment:6 Changed on Dec 23, 2016 at 2:10:53 PM by Sebastian Huber

Priority: normallow

comment:7 Changed on Jan 26, 2017 at 7:16:00 AM by Sebastian Huber


comment:8 Changed on Jan 27, 2017 at 7:06:50 AM by Sebastian Huber <sebastian.huber@…>

In 4ea92d1ed11f0fc93d6b40729ebe7ec5c03d448e/rtems:

score: Clarify _Heap_Extend()

Update #1747.

comment:9 Changed on Jan 27, 2017 at 7:08:24 AM by Sebastian Huber

Resolution: fixed
Status: acceptedclosed

comment:10 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber


comment:11 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber


Milestone renamed

Note: See TracTickets for help on using tickets.