Il 10/08/2013 00:57, Alex Bligh ha scritto: > There are a large number of users of qemu_free_timer (now timer_free). > > If someone does not call qemu_free_timer having called qemu_new_timer, > the timer sits there and basically does nothing.
If you have called qemu_del_timer, it is a memory leak. If you haven't, you'll get almost the same crash you describe here: > If we go to the timer_init model, the timer will either be on the > stack or (more likely) inside some other struct on the heap, which > will likely have been freed. This means walking the timer list will > be dangerous. With heap-allocated timers, the timer will exist on the heap, but likely the opaque will not and you'll get a crash in the callback. > This seems to add a good deal of fragility. It is really the same. The disadvantage is that you will not have a hint of which timer was accessed erroneously (the callback is a useful hint). The advantage is that you cannot leak timers, and the crash happens deterministically as soon as the object is deleted (rather than only when the timer fires). Paolo