Skip to contentSkip to conversation

heap: bad usage or design problem using named heaps ?

Xenomai Stéphane ANCELOT 2 participants 2 messages Mar 26, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

I faced the following problem with xeno 2.5.x , but may exist on other releases .

1/ I create a rt_heap
2/ in this rh_heap I alloc many named "data area"
I always give the global rt_heap ptr. no problem, areas are allocated.

3/problem arises when unallocating/unbinding
using rt_heap_free/rt_heap_unbind.
only the last segment created is freed. Because the global heap ptr size contains only size of the last allocation.

============================
to solve the problem, I had to use a distinct rt_heap for each named area, in this case.

At first, I may have misunderstood the way was working rt_heaps ? I was thinking I could manage only a heap with many named modules inside it...

Regards
S.Ancelot

#1 lore raw
Quoted 5 lines · Stéphane ANCELOT

Hi,

I faced the following problem with xeno 2.5.x , but may exist on other releases .

Or may not, since 2.5.x is obsolete (last release on August 2012), or if this turns to be usage issue.

Quoted 2 lines

1/ I create a rt_heap
2/ in this rh_heap I alloc many named "data area"

Some code is needed to understand the kind of heap your code creates.

Quoted 4 lines

I always give the global rt_heap ptr. no problem, areas are allocated.

3/problem arises when unallocating/unbinding
using rt_heap_free/rt_heap_unbind.

These routines have very different purposes. Why are you coupling them in your description of the issue?

Quoted 2 lines

only the last segment created is freed. Because the global heap ptr size contains only size of the last allocation.

I don't understand what you mean.

Quoted 5 lines

============================
to solve the problem, I had to use a distinct rt_heap for each named area, in this case.

What is a "named area" in the context of your application, if not a separate named heap in single-block mode (H_SINGLE)?

Quoted 5 lines

At first, I may have misunderstood the way was working rt_heaps ? I was thinking I could manage only a heap with many named modules inside it...

Please send a simple code fragment illustrating your use case.

Signature · 1 line
Philippe.