[sql] disable compaction while merge results

Summary: Not sure if useful but seems sensible. It disappears at the top of the stack when we do merging in SQL.

Reviewed By: mbouaziz

Differential Revision: D5824131

fbshipit-source-id: fd64752
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent cfd6148dab
commit 993ee56fa1

@ -20,6 +20,7 @@ compile everything from source (see the end of this document).
- opam 1.2.2 (instructions [here](https://opam.ocaml.org/doc/Install.html#OSX))
- Python 2.7
- sqlite
- pkg-config
- Java (only needed for the Java analysis)
- cmake (only needed for the C/Objective-C analysis)
@ -32,7 +33,7 @@ You can install some of these dependencies using
[Homebrew](http://brew.sh/):
```sh
brew install autoconf automake cmake opam pkg-config
brew install autoconf automake cmake opam pkg-config sqlite
brew cask install java
```

@ -962,15 +962,6 @@ module AnalysisResults = struct
if List.is_empty Config.anon_args then load_specfiles () else List.rev Config.anon_args )
else load_specfiles ()
(** apply [f] to [arg] with the gc compaction disabled during the execution *)
let apply_without_gc f arg =
let stat = Gc.get () in
let space_oh = stat.space_overhead in
Gc.set {stat with space_overhead= 10000} ;
let res = f arg in
Gc.set {stat with space_overhead= space_oh} ;
res
(** Load .specs files in memory and return list of summaries *)
let load_summaries_in_memory () : t =
let summaries = ref [] in
@ -981,7 +972,8 @@ module AnalysisResults = struct
| Some summary
-> summaries := (fname, summary) :: !summaries
in
apply_without_gc (List.iter ~f:load_file) (spec_files_from_cmdline ()) ;
let do_load () = spec_files_from_cmdline () |> List.iter ~f:load_file in
Utils.without_gc ~f:do_load ;
let summ_cmp (_, summ1) (_, summ2) =
let n =
SourceFile.compare summ1.Specs.attributes.ProcAttributes.loc.Location.file

@ -26,7 +26,8 @@ let merge ~into db =
let db_name = "db" in
SqliteUtils.check_sqlite_error ~fatal:true ~log:"attaching db"
(Sqlite3.exec into (Printf.sprintf "ATTACH '%s' AS %s" db db_name)) ;
merge_attributes_table ~into ~db_name ;
let do_merge () = merge_attributes_table ~into ~db_name in
Utils.without_gc ~f:do_merge ;
SqliteUtils.check_sqlite_error ~fatal:true ~log:"detaching db"
(Sqlite3.exec into (Printf.sprintf "DETACH %s" db_name)) ;
()

@ -308,3 +308,11 @@ let rec rmtree name =
-> Unix.unlink name
| exception Unix.Unix_error (Unix.ENOENT, _, _)
-> ()
let without_gc ~f =
let stat = Gc.get () in
let space_oh = stat.space_overhead in
Gc.set {stat with space_overhead= 10000} ;
let res = f () in
Gc.set {stat with space_overhead= space_oh} ;
res

@ -98,3 +98,6 @@ val rmtree : string -> unit
val try_finally_swallow_timeout : f:(unit -> 'a) -> finally:(unit -> unit) -> 'a
(** Calls [f] then [finally] even if [f] raised an exception. The original exception is reraised afterwards.
Where possible use [SymOp.try_finally] to avoid swallowing timeouts. *)
val without_gc : f:(unit -> unit) -> unit
(** Call [f ()] with the gc compaction disabled during the execution *)

Loading…
Cancel
Save