(* Command line argument parsing. *)
let prog = Filename.basename Sys.executable_name
-let indisk, outdisk, convert, format, ignores, machine_readable, quiet,
+let indisk, outdisk, convert, debug_gc,
+ format, ignores, machine_readable, quiet,
verbose, trace =
let display_version () =
let g = new G.guestfs () in
let add xs s = xs := s :: !xs in
let convert = ref "" in
+ let debug_gc = ref false in
let format = ref "" in
let ignores = ref [] in
let machine_readable = ref false in
let argspec = Arg.align [
"--convert", Arg.Set_string convert, "format Format of output disk (default: same as input)";
+ "--debug-gc", Arg.Set debug_gc, " Debug GC and memory allocations";
"--format", Arg.Set_string format, "format Format of input disk";
"--ignore", Arg.String (add ignores), "fs Ignore filesystem";
"--machine-readable", Arg.Set machine_readable, " Make output machine readable";
(* Dereference the rest of the args. *)
let convert = match !convert with "" -> None | str -> Some str in
+ let debug_gc = !debug_gc in
let format = match !format with "" -> None | str -> Some str in
let ignores = List.rev !ignores in
let machine_readable = !machine_readable in
if contains_comma then
error "input filename '%s' contains a comma; qemu-img command line syntax prevents us from using such an image" indisk;
- indisk, outdisk, convert, format, ignores, machine_readable, quiet,
- verbose, trace
+ indisk, outdisk, convert,
+ debug_gc, format, ignores, machine_readable, quiet,
+ verbose, trace
let () =
if not quiet then
wrap "Sparsify operation completed with no errors. Before deleting the old disk, carefully check that the target disk boots and works correctly.\n";
);
+ if debug_gc then
+ Gc.compact ();
+
exit 0