[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new w
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper |
Date: |
Sat, 10 Aug 2013 10:36:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 |
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
- Re: [Qemu-devel] [RFC] [PATCHv8 12/30] aio / timers: aio_ctx_prepare sets timeout from AioContext timers, (continued)
- [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Alex Bligh, 2013/08/08
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Paolo Bonzini, 2013/08/09
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Alex Bligh, 2013/08/09
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Paolo Bonzini, 2013/08/09
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Alex Bligh, 2013/08/09
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Paolo Bonzini, 2013/08/09
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Alex Bligh, 2013/08/09
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Paolo Bonzini, 2013/08/09
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper, Alex Bligh, 2013/08/09
- Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper,
Paolo Bonzini <=
[Qemu-devel] [RFC] [PATCHv8 08/30] aio / timers: Untangle include files, Alex Bligh, 2013/08/08
[Qemu-devel] [RFC] [PATCHv8 14/30] aio / timers: Convert aio_poll to use AioContext timers' deadline, Alex Bligh, 2013/08/08
[Qemu-devel] [RFC] [PATCHv8 07/30] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList, Alex Bligh, 2013/08/08
[Qemu-devel] [RFC] [PATCHv8 15/30] aio / timers: Convert mainloop to use timeout, Alex Bligh, 2013/08/08
[Qemu-devel] [RFC] [PATCHv8 16/30] aio / timers: On timer modification, qemu_notify or aio_notify, Alex Bligh, 2013/08/08