You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
971 B
29 lines
971 B
10 years ago
|
(*
|
||
7 years ago
|
* Copyright (c) 2009-2013, Monoidics ltd.
|
||
6 years ago
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
9 years ago
|
*
|
||
7 years ago
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
9 years ago
|
*)
|
||
9 years ago
|
|
||
8 years ago
|
open! IStd
|
||
7 years ago
|
open PolyVariantEqual
|
||
9 years ago
|
|
||
9 years ago
|
(** This module handles buckets of memory leaks in Objective-C/C++ *)
|
||
10 years ago
|
|
||
|
let bucket_to_message bucket =
|
||
7 years ago
|
match bucket with `MLeak_cpp -> "[CPP]" | `MLeak_unknown -> "[UNKNOWN ORIGIN]"
|
||
10 years ago
|
|
||
|
|
||
7 years ago
|
let contains_cpp = List.mem ~equal:( = ) Config.ml_buckets `MLeak_cpp
|
||
9 years ago
|
|
||
7 years ago
|
let contains_unknown_origin = List.mem ~equal:( = ) Config.ml_buckets `MLeak_unknown
|
||
9 years ago
|
|
||
7 years ago
|
let should_raise_leak_unknown_origin = contains_unknown_origin
|
||
9 years ago
|
|
||
7 years ago
|
let ml_bucket_unknown_origin = bucket_to_message `MLeak_unknown
|
||
9 years ago
|
|
||
9 years ago
|
(* Returns whether a memory leak should be raised for a C++ object.*)
|
||
|
(* If ml_buckets contains cpp, then check leaks from C++ objects. *)
|
||
7 years ago
|
let should_raise_cpp_leak = if contains_cpp then Some (bucket_to_message `MLeak_cpp) else None
|