Change Hashtbl.clear to Hashtbl.reset

Summary:
Replace Hashtbl.clear with Hashtbl.reset

This saves memory because the reset method shrinks the hash-table, whereas the clear method just empties it

Reviewed By: jvillard

Differential Revision: D16004966

fbshipit-source-id: f32b00b0f
master
Phoebe Nichols 5 years ago committed by Facebook Github Bot
parent 4ce3ff944d
commit 2f8d09c651

@ -46,7 +46,7 @@ module NodeMap = Caml.Hashtbl.Make (Int)
[trim_id_map] makes the image equal to the domain of [node_map]. *) [trim_id_map] makes the image equal to the domain of [node_map]. *)
type t = {id_map: int IdMap.t; node_map: Node.t NodeMap.t} type t = {id_map: int IdMap.t; node_map: Node.t NodeMap.t}
let clear {id_map; node_map} = IdMap.clear id_map ; NodeMap.clear node_map let reset {id_map; node_map} = IdMap.reset id_map ; NodeMap.reset node_map
let create initial_capacity = let create initial_capacity =
{id_map= IdMap.create initial_capacity; node_map= NodeMap.create initial_capacity} {id_map= IdMap.create initial_capacity; node_map= NodeMap.create initial_capacity}

@ -23,7 +23,7 @@ module Node : NodeSig
type t type t
val clear : t -> unit val reset : t -> unit
val create : int -> t val create : int -> t
(** [create n] makes an empty graph with initial capacity [n] which grows as required *) (** [create n] makes an empty graph with initial capacity [n] which grows as required *)

@ -55,7 +55,7 @@ let bottom_up sources : target task_generator =
(CallGraph.n_procs g) ; (CallGraph.n_procs g) ;
if Config.debug_level_analysis > 0 then CallGraph.to_dotty g "cycles.dot" ; if Config.debug_level_analysis > 0 then CallGraph.to_dotty g "cycles.dot" ;
(* save some memory *) (* save some memory *)
CallGraph.clear g ) ; CallGraph.reset g ) ;
empty empty
in in
let rec next_aux () = let rec next_aux () =

Loading…
Cancel
Save