Message memory possiblly leaked?

Rloase Flinne Rloase at
Sat Jan 10 03:34:02 UTC 2004

------ '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 :)

>> Thanks.

Rloase Flinne

More information about the users mailing list