rtems-leon resources leak detection

Paul Whitfield paulw at omnitronics.com.au
Mon Jan 9 00:36:36 UTC 2006


wilfried.fauvel at laposte.net wrote:
> Hi all,
> I am new in rtems world, I'm using RTEMS 4.6.5 on leon 2 (under tsim) and I would like to know how can I detect resources leak (task/semaphore/...) ?
> 

I am assuming you mean that you are creating RTEMS objects, but
at some point running out of RTEMS workspace.

If this discussion does not help perhaps you could provide
a more detailed description of your problem:

Depending on your configuration the number of RTEMS objects of a
particular type are either limited to a fixed ceiling value
or set to "unlimited" using the rtems_resource_unlimited macro.

Unlimited just means that they are allocated in chunks as required
from the RTEMS workspace.

So if you are using unlimited or auto extending resources, you could
run the whole system out of RTEMS workspace, and when you attempt
to create a resource you will get an error code returned.

You should always check the status code returned by a call to
create a resource to ensure that it has worked.

So my strategy to detect an RTEMS "resource" leak would be
to work out how many of each RTEMS object type your system
requires and configure that maximum value to be fixed in the configuration.

This will force each type of object to be limited and will remove
any interaction between the allocation of object types...

i.e. if you run out of semaphores it will have no effect on
the allocation of tasks etc..

This should narrow it down to what type of object is "leaking".

At this point I would then add debug code for everywhere
a resource is created and deleted, making sure that
you always check the returned status from all creation / deletion
call.

Also note: If you are using the RTEMS monitor it provides
some functions for dumping number and state of some rtems objects.

If you are in fact chasing a memory leak rather than a
resource leak... well that is a different story :-)

Regards


Paul

=========================================================================
The information in this e-mail is intended for the addressee only.
Unauthorised use, copying, disclosure or distribution by anyone else
is prohibited. Please let us know immediately if you receive this
e-mail in error. Thank you.
=========================================================================




More information about the users mailing list