From 0872a9219f713341e3fb8a3ed2c9f01519716f83 Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Wed, 15 Dec 2010 17:13:21 -0500 Subject: [PATCH] Fixed slow memory leak --- directfifowatcher.ml | 3 ++- main.ml | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/directfifowatcher.ml b/directfifowatcher.ml index 8e8b4dc..206ca53 100644 --- a/directfifowatcher.ml +++ b/directfifowatcher.ml @@ -162,7 +162,8 @@ let sigchld_handle s = try let fqp_in,fd_out = Hashtbl.find pidmap pid in begin - reopenentry fqp_in + reopenentry fqp_in; + Hashtbl.remove pidmap pid end with _ -> () end; diff --git a/main.ml b/main.ml index 43410ae..7f91dbf 100644 --- a/main.ml +++ b/main.ml @@ -25,6 +25,10 @@ let cmdspeclist = ("-failsafe",Arg.Set(Globals.failsafe), "Never crash. Be stupid, but never crash. Use at your own risk."); ] +let sighup_handle s = + print "Received sighup. Running GC major pass"; + Gc.major () + let _ = Arg.parse cmdspeclist (fun x->()) "Usage: vsys "; Globals.logfd:=open_out_gen [Open_append;Open_creat] 0o644 !log_filepath; @@ -55,6 +59,8 @@ let _ = input_file_list:=List.concat [!input_file_list;frontends] end; + Sys.set_signal Sys.sigusr1 (Sys.Signal_handle sighup_handle); + let felst = List.map (fun lst->let (x,y)=lst in logprint "Slice %s (%s)\n" x y; -- 2.43.0