[splint-discuss] Splint and Thread Local Storage (TLS)

Jeff Johnson n3npq at mac.com
Fri Jan 15 10:19:13 PST 2010


On Jan 15, 2010, at 12:14 PM, AlannY wrote:

> Hi there. I'm newbie in splint and now I've faced with problem of  
> Thread Local Data.
>
> My library uses threads (via pthread) and saves some very important  
> information in
> thread local storage.
>
> Splint shows tons of warnings about memory leaks. How to tell  
> splint, that some data my be
> used later, even if all references on it are gone.
>

You're in for a *LOT* of pain using splint on TLS imho.

See the means to extend splint annotations with abstract "tainting"
assertions. That could be a means to handle TLS annotations w splint
(untested).

A /*@only@*/ "works" if your code paths using TLS are sufficiently
well contained that splint can see TLS used solely within the code
path. You may need to warp your code paths so that TLS usage within,
say, a single routine is identical to "mustfree" behavior.

Otherwise, just disable all the warnings until you figger out how
to annotate TLS.

Again, jmho and what I would do. YMMV, likely will.
> For example, I've got message about fresh storage:
>
>    my_file.c:000:0: Fresh storage <var> not released before return
>  A memory leak has been detected. Storage allocated locally is not  
> released
>  before the last reference to it is lost. (Use -mustfreefresh to  
> inhibit
>  warning)
>   my_file.c:000:00: Fresh storage <var> created
>
> I understand, that it's very hard to keep track of that data. So,  
> I'm looking for a *hack*.
>

Disable whatever you don't want to see.

73 de Jeff
> I tryed to set state-variable to TLS at the end of each function,  
> that uses TLS, but without any success,
> splint still thinks, that all references gone.
>
> Thank you.
> -- 
>   )\._.,--....,'``.
>  /,   _.. \   _\  (`._ ,.
> `._.-(,_..'--(,_..'`-.;.'
> _______________________________________________
> splint-discuss mailing list
> splint-discuss at mail.cs.virginia.edu
> http://www.cs.virginia.edu/mailman/listinfo/splint-discuss



More information about the splint-discuss mailing list