Skip to content

Commit

Permalink
Protect my leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom committed Jun 24, 2024
1 parent d6d1ca5 commit 63a96f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/bitwuzla_mappings.default.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ include Mappings_intf

let _debug = false

let leak_mutex = Mutex.create ()

let leaky_list = ref []

module Fresh_bitwuzla (B : Bitwuzla_cxx.S) : M = struct
Expand Down Expand Up @@ -416,7 +418,9 @@ include (
module Make () = struct
let bitwuzla = (module Bitwuzla_cxx.Make () : Bitwuzla_cxx.S)

let () = leaky_list := bitwuzla :: !leaky_list
let () =
Mutex.protect leak_mutex (fun () ->
leaky_list := bitwuzla :: !leaky_list )

include Fresh_bitwuzla ((val bitwuzla))
end
Expand Down

0 comments on commit 63a96f3

Please sign in to comment.