I think the memory leaks are still there if the Time of Day gets updated too far.
It looks like su_monotime() was added, but the timers are not using it.

I'm testing a fix that changes su_time() and forces it to be monotonic much like the way the kernel does monotonic time.
The time of day will be off for su_time() but it didn't seem to hurt anything.
I think the better fix is to change all the calls to su_time() for timers and call su_monotime() instead.

Here is my code for the 1.12.6 version The function is su_time().,

diff -r1.1 -r1.2
70a71,75
> // attempt at making time monotonic
> unsigned long prev_tv_sec = 0;
> unsigned long prev_tv_usec = 0;
> unsigned long mono_tv_sec_adj = 0;
>
75a81,104
>       if ( prev_tv_sec &&
>          ( (tv->tv_sec > prev_tv_sec + 2) ||
>            (tv->tv_sec < prev_tv_sec) ) )
>       {
>               // Time warp.....(someone set the clock or we fell asleep over 2 seconds.)
>               // fix up our monotonic so we are in the same second as last time
>               unsigned long adj;
>
>               adj = (prev_tv_sec - tv->tv_sec);
>
>               // if we were futher along in the second jump to the next.
>               if ( prev_tv_usec > tv->tv_usec )
>               {
>                       adj++;
>               }
>               SU_DEBUG_2(("Clock slip detected, %ld seconds. Previous Monotonic adjustment %ld. Current %ld sec, %ld usec, Prev %ld sec %ld usec",
>                                       adj, mono_tv_sec_adj, tv->tv_sec, tv->tv_usec, prev_tv_sec, prev_tv_usec ));
>               mono_tv_sec_adj += adj;
>       }
>
>       prev_tv_sec = tv->tv_sec;
>       prev_tv_usec = tv->tv_usec;
>       tv->tv_sec += mono_tv_sec_adj;
>

Colin..

Fabio Margarido wrote:
Hi there Pekka,

back in April, I got this response to a question about an assertion
regarding nta timers:

  
The code calculating the timeouts has flawed logic, the problem shows
up if the system clock is adjusted or the load is too high.
    

I'd like to know if this issue has already been resolved in the darcs
tree. I've noticed that when the system clock is adjusted sofia-sip
apparently leaks memory.
I'm still using 1.12.8 because of the other memory leaks in 1.12.9
that have been reported to the list. Are those fixed too?
Thanks.

Fabio

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url="">
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel
  
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to