On 10/14/2015 02:21 PM, Frederik Bayart wrote:
>> On Wednesday, 14 October 2015, 12:43, Philippe Gerum <r...@xenomai.org> 
>> wrote:
>> On 10/14/2015 12:22 PM, Frederik Bayart wrote:
>>> Hallo,
>>> I'm using xenomai 3.0 on kernel 3.18.20 (64 bit).
>>>
>>> When using single block heap, I'm getting memory allocation problem when 
>>> calling rt_heap_alloc with size 0. I don't get the error when calling the 
>>> function with size used in rt_heap_create.
>>> On the mailing list, I found there has been an issue with this in May : 
>>> http://www.xenomai.org/pipermail/xenomai/2015-May/034165.html
>>> Is this still an issue ?
>>
>> No, this one is long gone.
>>
>>>
>>> In attachment a test program htest.c + makefile to generate the problem :
>>>
>>> $ sudo ./htest 1  ==> use 0
>>> htest.c:69: heapsize = 70000, usablemem = 70144, usedmem = 0
>>> htest.c:79 ERROR: rt_heap_alloc(-12): Cannot allocate memory
>>>
>>> $ sudo ./htest 1  ==> use same size as in create
>>> htest.c:69: heapsize = 70000, usablemem = 70144, usedmem = 0
>>> htest.c:92: heapsize = 70000, usablemem = 70144, usedmem = 70144
>>>
>>
>> Does this help?
>>
>> diff --git a/lib/alchemy/heap.c b/lib/alchemy/heap.c
>> index 20531e3..146bfa1 100644
>> --- a/lib/alchemy/heap.c
>> +++ b/lib/alchemy/heap.c
>> @@ -442,7 +442,9 @@ int rt_heap_alloc_timed(RT_HEAP *heap,
>>         p = __mptr(hcb->sba);
>>         if (p)
>>             goto done;
>> -        if (size > 0 && size != hcb->size) {
>> +        if (size == 0)
>> +            size = heapobj_size(&hcb->hobj);
>> +        else if (size != hcb->size) {
>>             ret = -EINVAL;
>>             goto done;
>>
>>         }
>>
> 
> After code reading, could it be that the exception for size == 0 has 
> disappeared in the released code ?
> 

Did you try that patch?

-- 
Philippe.

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai

Reply via email to