On Fri, Nov 14, 2008 at 12:00:10PM -0500, David Lively wrote:
> > +JNIEXPORT void JNICALL Java_org_libvirt_Connect_registerForDomainEvents
> > +(JNIEnv *env, jobject obj, jlong VCP){
> > + // TODO: Need to DeleteGlobalRef(obj) when deregistering for
callbacks.
> > + // But then need to track global obj per Connect object.
>
> Hum, that's a bit nasty. Can we make sure we can plug the leaks
> without having to change the APIs, that would be a bummer...
Yeah. It's really not acceptable as is. The easiest solution (as you
hint) is changing the API so virConnectDomainEventDeregister returns the
void * registered with that callback. That would (of course) be my
preference. What do you think? That API hasn't been released quite
yet ...
Or have the virConnectDomainEventRegister method take an extra parameter
which is a callback void (*freefunc)(void*). libvirt would just invoke
that to free the opaque data chunk.
I think we need a similar thing with the event loops APIs for timers
and file handle watches, to make it easier to free the opaque data
blob they have.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|