#536 closed defect (fixed)

Heap manager uses memory excessively.

Reported by: osv2 Owned by: Joel Sherrill
Priority: lowest Milestone: 2
Component: score Version: 4.6
Severity: normal Keywords:
Cc: bugs@…, osv@… Blocked By:
Blocking:

Description

The change to return pointers aligned to the page_size boundary introduced between revisions 1.3 and 1.4 of the file 'tems/cpukit/score/src/heap.c' results in significant increase of memory usage by every heap in the system. The problem is that the code blindly adds page_size to every allocation request.

For an example taken from the manual where 350 bytes request is made for the heap with page_size=256, the memory spent would be 512+8+256 compared to 512+8 in previous implementation that is 50% overhead compared to previous implementation and 84% overhead total!

For the usual configuration used by workspace and malloc managers where page_size==CPU_HEAP_ALIGNMENT, each allocated peace has additional 4 or 8 bytes overhead compared to previous implementation.

The suggestion is to revert this change and implement special routine, _Heap_Allocate_aligned(the_heap, size, alignment) instead that could be used then to implement memalign() call found in some general purpose allocators. I think I can implement it as soon as the suggestion is accepted.

Release:
RTEMS-4.6

Attachments (3)

new-heap-20041110.patch.gz (16.4 KB) - added by osv2 on Dec 3, 2006 at 1:31:13 PM.
new-heap-20041110.patch.gz
new-heap-rtems-ss-20030703.patch.gz (16.0 KB) - added by osv2 on Dec 3, 2006 at 1:31:13 PM.
new-heap-rtems-ss-20030703.patch.gz
rtems-cvs-20041221-new-heap-alignment.patch.gz (16.8 KB) - added by osv2 on Dec 3, 2006 at 1:31:13 PM.
rtems-cvs-20041221-new-heap-alignment.patch.gz

Download all attachments as: .zip

Change History (4)

comment:1 Changed on Dec 4, 2003 at 1:34:39 PM by Joel Sherrill

Status: assignedwaiting

comment:2 Changed on Jan 20, 2005 at 5:30:16 PM by Joel Sherrill

Status: waitingclosed

comment:3 Changed on Jan 21, 2005 at 2:53:05 AM by osv2

From: Sergei Organov <osv@…>
To: bugs@…
Cc: joel@…, jmj@…, jennifer@…,

ralf_corsepius@…, chrisj@…, norume@…,
vvv@…, mayes@…, trauscher@…

Subject: Re: RTEMS Re: rtems/536
Date: 20 Jan 2005 21:53:05 +0300

RTEMS-gnats@… writes:

Synopsis: Heap manager uses memory excessively.

State-Changed-From-To: feedback->closed
State-Changed-By: joel
State-Changed-When: Thu, 20 Jan 2005 12:30:16 -0600
State-Changed-Why:
Patch applied with minor edits to CVS trunk.


Thanks! It means I can now prepare yet another patch that implements
'realloc' support in the heap manager. I think I'll create yet another
PR and attach the patch there as soon as it's ready, OK?


It is too radical to be applied to the 4.6 branch.


Sure. AFAIR it has never been considered to be included into 4.6 anyway.


--
Sergei.

Changed on Dec 3, 2006 at 1:31:13 PM by osv2

rtems-cvs-20041221-new-heap-alignment.patch.gz

Note: See TracTickets for help on using tickets.