[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2 of 3] support of cpupools in xl: commands and library changes
On Fri, 2010-10-08 at 12:23 +0100, Juergen Gross wrote: You need a destructor for the libxl_cpumap type, else you will leak the ->map. Also you don't need to explicitly specific destructor_fn for libxl_cpupoolinfo. Something like the following. (hint: you can usually spot this stuff by taking a look at the diff of the generated code in tools/libxl/_libxl_types.[ch]). Ian. diff -r 11f243c2d8be tools/libxl/libxl.h --- a/tools/libxl/libxl.h Fri Oct 08 13:22:37 2010 +0200 +++ b/tools/libxl/libxl.h Tue Oct 12 10:55:13 2010 +0100 @@ -147,6 +147,7 @@ typedef struct { uint32_t size; /* number of bytes in map */ uint64_t *map; } libxl_cpumap; +void libxl_cpumap_destroy(libxl_cpumap *map); typedef enum { XENFV = 1, diff -r 11f243c2d8be tools/libxl/libxl.idl --- a/tools/libxl/libxl.idl Fri Oct 08 13:22:37 2010 +0200 +++ b/tools/libxl/libxl.idl Tue Oct 12 10:55:13 2010 +0100 @@ -6,7 +6,7 @@ libxl_ctx = Builtin("ctx") libxl_ctx = Builtin("ctx") libxl_uuid = Builtin("uuid") libxl_mac = Builtin("mac") -libxl_cpumap = Builtin("cpumap") +libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE) libxl_qemu_machine_type = Number("qemu_machine_type", namespace="libxl_") libxl_console_consback = Number("console_consback", namespace="libxl_") libxl_console_constype = Number("console_constype", namespace="libxl_") @@ -49,7 +49,7 @@ libxl_cpupoolinfo = Struct("cpupoolinfo" ("sched_id", uint32), ("n_dom", uint32), ("cpumap", libxl_cpumap) - ], destructor_fn="libxl_cpupoolinfo_destroy") + ]) libxl_vminfo = Struct("vminfo", [ ("uuid", libxl_uuid), diff -r 11f243c2d8be tools/libxl/libxl_utils.c --- a/tools/libxl/libxl_utils.c Fri Oct 08 13:22:37 2010 +0200 +++ b/tools/libxl/libxl_utils.c Tue Oct 12 10:55:13 2010 +0100 @@ -720,6 +720,11 @@ int libxl_cpumap_alloc(libxl_cpumap *cpu return 0; } +void libxl_cpumap_destroy(libxl_cpumap *map) +{ + free(map->map); +} + int libxl_cpumap_test(libxl_cpumap *cpumap, int cpu) { if (cpu >= cpumap->size * 8) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |