[libvirt] [PATCH 2/2] Ensure JNA callbacks cannot get GCed
Claudio Bley
cbley at av-test.de
Wed Mar 26 07:24:35 UTC 2014
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.
Should we squash this into patch 41/65 before pushing the series?
More information about the libvir-list
mailing list