From: "Stéphane ANCELOT" <sancelot@free.fr>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] xenomai 3.0rc4 rt_heap_alloc replies with timeout
Date: Wed, 06 May 2015 10:21:18 +0200 [thread overview]
Message-ID: <5549CEFE.6070000@free.fr> (raw)
In-Reply-To: <20150505172113.GO1993@hermes.click-hack.org>
On 05/05/2015 19:21, Gilles Chanteperdrix wrote:
> On Tue, May 05, 2015 at 03:37:40PM +0200, Stéphane ANCELOT wrote:
>> Hi,
>> unfortunately, There is something wrong for unknown reason using these
>> functions.
>>
>> I made a simple regression program that only create heaps and allocates
>> area.
>>
>> At line 190 of the file, depending on the size value of the heap, the
>> program works or not.
>> This looks like corrupted memory problem...
> I do not see anything in your reports would could make think of a
> corrupted memory problem. Are you sure this is not simply a problem
> in the overhead calculation? Have you tried to call rt_heap_inquire
> between rt_heap_create and rt_heap_alloc to see if the usablemem
> field shows a big enough value?
>
have a look at the program and the execution. I am a bit surprised that
available usablemem is greater than heap size .
execution :
0"002.800| BUG: [main] trace assertion failed:
../heap_test.cpp:251 => "ret == 0"
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
heap size : 36800 heap usablemem: 37376
program:
#include <iostream>
#include <stdlib.h>
#include <copperplate/traceobj.h>
#include <alchemy/task.h>
#include <alchemy/heap.h>
#include <alchemy/queue.h>
#define HEAPSIZE 16384
#define MSGSIZE 16
#define NMESSAGES (HEAPSIZE / MSGSIZE)
#define POOLSIZE (NMESSAGES * sizeof(void *))
static struct traceobj trobj;
using namespace std;
static RT_HEAP heap1, heap2;
RT_HEAP_INFO info;
int main(int argc, char *const argv[])
{
int ret;
void *p;
int size;
traceobj_init(&trobj, argv[0], 0);
int flags;
flags = H_FIFO ;
size = 36800;
ret = rt_heap_create(&heap2, "progauto1", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation1", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto2", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation2", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto3", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation3", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto4", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation4", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto5", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation5", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto6", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation6", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_inquire(&heap2,&info);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto7", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation7", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto8", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation8", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto9", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation9", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto10", size, flags);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "progauto_simulation10", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
size = 110400;
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "defprog", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
size = 3200;
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "tempo", size, flags);
traceobj_assert(&trobj, ret == 0);
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
size = 824; // size = 824 is failing but changing size to 3200
rocks ...
// --------------------------------------------------------------
ret = rt_heap_create(&heap2, "config", size, flags);
traceobj_assert(&trobj, ret == 0);
cout << " heap size : " << info.heapsize << " heap usablemem: " <<
info.usablemem;
ret = rt_heap_alloc(&heap2, size, TM_INFINITE, &p);
traceobj_assert(&trobj, ret == 0);
exit(0);
}
next prev parent reply other threads:[~2015-05-06 8:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 15:50 [Xenomai] xenomai 3.0rc4 rt_heap_alloc replies with timeout Stéphane ANCELOT
2015-04-28 17:25 ` Philippe Gerum
2015-04-30 7:08 ` Stéphane ANCELOT
2015-04-30 8:34 ` Philippe Gerum
2015-04-30 12:30 ` Stéphane ANCELOT
2015-05-05 13:37 ` Stéphane ANCELOT
2015-05-05 17:21 ` Gilles Chanteperdrix
2015-05-06 8:21 ` Stéphane ANCELOT [this message]
2015-05-06 8:23 ` Gilles Chanteperdrix
2015-05-06 8:26 ` Gilles Chanteperdrix
2015-05-06 8:31 ` Stéphane ANCELOT
2015-05-06 8:48 ` Gilles Chanteperdrix
2015-05-06 9:14 ` Philippe Gerum
2015-05-06 8:56 ` Philippe Gerum
2015-05-06 9:55 ` Stéphane ANCELOT
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5549CEFE.6070000@free.fr \
--to=sancelot@free.fr \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.