[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 11/24] golang/xenlight: define CpuidPolicyList builtin type



> Hmm, this introduces a pretty significant risk of memory leaks; but I
> don't really see any way around it.  I guess we really want to do some
> SetFinalizer() magic on this to call libxl_cpuid_dispose()?
>
> We might also want to add something like a .Dispose() method to have
> predictable memory effects.  But then do we want to have a .Dispose()
> method on all types that might contain a CpuidPolicyList?  Technically
> we're supposed to, so we might have to. (And now I'm having deja vu,
> like we've had this discussion before, but I can't seem to find it.)

As I've expressed before, I don't think its a good idea to look to the
runtime to fix this sort of problem, so I'd be more inclined to look
into a Dispose like option. But then it does seem weird from an API
perspective to only define Dispose on some types since it introduces a
closer, but incomplete, semantic relationship between libxl and the Go
package.

WRT the definition of CpuidPolicyList, is the best we can do? Or is
there a way we can hide the use of the C type better so that someone
using this package doesn't need to worry about calling Dispose or
otherwise? I think [1] is where we originally discussed this.

-NR

[1] https://lists.xenproject.org/archives/html/xen-devel/2019-09/msg01112.html

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.