On 10/7/19 4:12 PM, Nick Rosbrook wrote: > From: Nick Rosbrook <rosbro...@ainfosec.com> > > Define CpuidPolicyList as a wrapper struct with field val of type > *C.libxl_cpuid_policy_list and implement fromC and toC functions. > > Signed-off-by: Nick Rosbrook <rosbro...@ainfosec.com> > --- > Cc: George Dunlap <george.dun...@citrix.com> > Cc: Ian Jackson <ian.jack...@eu.citrix.com> > Cc: Wei Liu <w...@xen.org> > > tools/golang/xenlight/xenlight.go | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/tools/golang/xenlight/xenlight.go > b/tools/golang/xenlight/xenlight.go > index d41de253f3..9c384485e1 100644 > --- a/tools/golang/xenlight/xenlight.go > +++ b/tools/golang/xenlight/xenlight.go > @@ -249,6 +249,26 @@ type EvLink struct{} > func (el *EvLink) fromC(cel *C.libxl_ev_link) error { return nil } > func (el *EvLink) toC() (cel C.libxl_ev_link, err error) { return } > > +// CpuidPolicyList represents a libxl_cpuid_policy_list. > +type CpuidPolicyList struct { > + val *C.libxl_cpuid_policy_list > +}
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.) -George _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel