[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 19/28] libxl: ocaml: add dominfo_list and dominfo_get
[...] > > + domlist = temp = Val_emptylist; > > + for (i = nb - 1; i >= 0; i--) { > > + domlist = caml_alloc_small(2, Tag_cons); > > + Field(domlist, 0) = Val_int(0); > > + Field(domlist, 1) = temp; > > + temp = domlist; > > + > > + Store_field(domlist, 0, Val_dominfo(&c_domlist[i])); > > Is the preceding "Field(domlist, 0) = Val_int(0);" storing to the same place > and therefore redundant? I think the main reason to do this here is that caml_alloc_small (a low-level function) does not initialise the fields (as Dave pointed out earlier), and it is necessary to initialise the fields before doing any subsequent allocation on the OCaml heap (e.g. in Val_dominfo). If you don't do that, the GC may try to evaluate the uninitialised value. Cheers, Rob _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |