Message memory possiblly leaked?

Joel Sherrill joel.sherrill at OARcorp.com
Tue Jan 6 15:20:05 UTC 2004


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 Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985




More information about the users mailing list