Hi Paolo, On 5/21/2012 10:12 AM, Paolo Bonzini wrote:
That's pretty heavy-weight. Perhaps you can try the usual algorithm of looking at x->next and x->next->next?
That would only detect cycles of length 1 and 2 though. While that would cover all the testcases we currently know about, I wanted to eliminate the entire pattern of hangs. Otherwise it's only a question of time until someone hits a cycle of length >= 3.
We could use less memory at the expense of CPU time by using the tortoise and hare algorithm, but that would make the code much more complicated.
Andrew