Skip to content

Commit

Permalink
Add Z3_get_estimated_alloc_size to OCaml API (#7068)
Browse files Browse the repository at this point in the history
  • Loading branch information
wintersteiger committed Dec 21, 2023
1 parent 19f3ad4 commit 68a2c08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/ml/ml_example.ml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ let fpa_example ( ctx : context ) =
(
let solver = (mk_solver ctx None) in
(Solver.add solver [ c5 ]) ;
Printf.printf "Memory in use before `check`: %Lu bytes\n" (Statistics.get_estimated_alloc_size());
if (check solver []) != SATISFIABLE then
raise (TestFailedException "")
else
Expand Down
3 changes: 3 additions & 0 deletions src/api/ml/z3.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,9 @@ struct
let get (x:statistics) (key:string) =
try Some(List.find (fun c -> Entry.get_key c = key) (get_entries x)) with
| Not_found -> None

let get_estimated_alloc_size =
Z3native.get_estimated_alloc_size
end


Expand Down
3 changes: 3 additions & 0 deletions src/api/ml/z3.mli
Original file line number Diff line number Diff line change
Expand Up @@ -3224,6 +3224,9 @@ sig

(** The value of a particular statistical counter. *)
val get : statistics -> string -> Entry.statistics_entry option

(** The estimated allocated memory in bytes. *)
val get_estimated_alloc_size : unit -> int64
end

(** Solvers *)
Expand Down

0 comments on commit 68a2c08

Please sign in to comment.