[libvirt] [PATCH 2/2] Ensure JNA callbacks cannot get GCed

Chris Ellis chris at intrbiz.com
Wed Mar 26 10:00:41 UTC 2014


On Wed, Mar 26, 2014 at 7:24 AM, Claudio Bley <cbley at av-test.de> wrote:

> At Wed, 26 Mar 2014 02:43:49 +0000,
> Chris Ellis wrote:
> >
> > Currently nothing prevents the JNA callback objects used when registering
> > for domain events from being garbage collected.  JNA requires that
> callback
> > objects are not GCed whilst they are in use by C code.
> >
> > To solve this we hold a reference to the callback alongside the callback
> id.
> > This ensures that the JNA callback objects will retain in memory while
> it is
> > registered with the C layer.
> >
> > We also use an IdentityHashMap rather than a HashMap to store the
> EventListener
> > objects.
> > ---
> >  src/main/java/org/libvirt/Connect.java | 37
> ++++++++++++++++++++++------------
> >  1 file changed, 24 insertions(+), 13 deletions(-)
>
> Nice catch. ACK.
>

Thanks.


>
> Should we squash this into patch 41/65 before pushing the series?
>

Yes that would make sense, or you can chain my patch at the end, I'll leave
that upto you.

I've noticed that there are some other related errors, I'll push patches
for these later today.

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140326/92ca0ccc/attachment-0001.htm>


More information about the libvir-list mailing list