瀏覽代碼

Objsize workaround with Obj.reachable_words (#12258)

Yuxiao Mao 3 月之前
父節點
當前提交
e4651c873f
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      libs/objsize/objsize.ml

+ 3 - 1
libs/objsize/objsize.ml

@@ -11,7 +11,9 @@ type info =
 
 external internal_objsize : Obj.t -> Obj.t list -> Obj.t list -> info = "ml_objsize"
 
-let objsize obj exclude reach = internal_objsize (Obj.repr obj) exclude reach
+let objsize obj (exclude:Obj.t list) (reach:Obj.t list) =
+  (* internal_objsize (Obj.repr obj) exclude reach *)
+  {data = (Obj.reachable_words (Obj.repr obj)); headers = 0; depth = 0; reached = false}
 
 let size_with_headers i = (Sys.word_size/8) * (i.data + i.headers)