Message memory possiblly leaked?

Joel Sherrill joel.sherrill at oarcorp.com
Sun Jan 11 01:35:05 UTC 2004


Rloase Flinne wrote:

> ------ 'Joel Sherrill' said the following on 2004-01-06 23:20 ------:
>
>> Rloase Flinne wrote:
>>
>>>
>>> Hi there,
>>> I've debugging my application which uses rtems message queue api's for
>>> serval days. I knew that the messages are copied into rtems workspace.
>>> Today after reading some source files I find that when I flush( using
>>> rtems_message_queue_flush() ) a message queue and at the same time 
>>> there
>>> are some messages still pending on the queue, the messages memory
>>> is not freed.
>>>
>>> Could this be a possible memory leak? Do I miss anything important?
>>
>>
>>
>> I did a cursory review of the code in question and I don't see a leak.
>> The code in cpukit/score/src/coremsgqflushsupp.c does a minor trick
>> and appends the entire list of pending messages on the inactive
>> message list. Thus you will not find code to explcitly remove
>> individual messages from the pending list and free them.  This
>> changes an O(n) algorithm into a fixed O() algorithm.
>>
>> If you really believe you are leaking memory, could you please
>> post an EXTREMELY simple test case demonstrating the leak and
>> how you know there is one.  If there is a leak, it should be
>> possible to create a queue with maximum pending messages of 1,
>> send one, flush and not be able to send again.
>
>
> Thanks Joel. I've done a test. No, there isn't any memory leaking. The 
> memory used for messages is still there managed by inactive or pending 
> message chain.
> I didn't understand the code very well.
> Thanks again :)
>
I'm glad to hear that you concur there isn't a leak.  But I have learned 
over the years to
take all hints of a problem like this seriously.  They are easy to 
accidentally create and
can lurk for a long time before someone spots it.

--joel

>>> Thanks.
>>>
>>
>>
>
>





More information about the users mailing list