Subject: Re: bug#12447: 24.1.50; Stuck in garbage collection on OS X

From: Dmitry Gutov <[email-masked]>
Date: Sun, 16 Sep 2012 19:56:11 +0400

On 16.09.2012 18:54, Eli Zaretskii wrote:
>> Date: Sun, 16 Sep 2012 18:25:50 +0400
>> From: Dmitry Gutov <[email-masked]>
>> CC: [email-masked], [email-masked]
>>
>>> Perhaps the problem is that the value of 'difference' is not
>>> initialized:
>>>
>>>     while (CONSP (timers) || CONSP (idle_timers))
>>>       {
>>>         Lisp_Object timer = Qnil, idle_timer = Qnil;
>>>         EMACS_TIME timer_time, idle_timer_time;
>>>         EMACS_TIME difference;   <<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>
>>> and then never set to any specific value, until here:
>>>
>>>         else
>>> 	/* When we encounter a timer that is still waiting,
>>> 	   return the amount of time to wait before it is ripe.  */
>>> 	{
>>> 	  UNGCPRO;
>>> 	  return difference;
>>> 	}
>>>
>>> which causes us return garbage, potentially zero, to timer_check.
>>
>> It's assigned to, though. When we encounter a timer that's not yet ripe.
>
> What if all of them are ripe?

I don't see the problem. The first timer is ripe? Fire it and return 
'nexttime'. Otherwise, return 'difference', which now has been assigned 
a value.
If we've reached the end of the list, again return 'nexttime', which is 
initialized with invalid_emacs_time () at the beginning of timer_check_2.

Anyway, I think the immediate problem is that the newly created timer 
can be considered ripe.