Permalink
Browse files

[fix] mongo,buffer,pool: defautl is to disactivate, and activation ca…

…nnot waste more than 256Mb

CHANGELOG Fix memory leak in the mongodb driver
  • Loading branch information...
1 parent 133c793 commit 8102678014fb27a9769a60dd2f85a142b94c6899 @OpaOnWindowsNow OpaOnWindowsNow committed May 29, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −0 libbase/debugVariables.ml
  2. +1 −0 libbase/debugVariables.mli
  3. +4 −3 libbase/mongo.ml
@@ -105,6 +105,7 @@ let lambda_debug = var "lambda_debug"
let low_level_db_log = var "low_level_db_log"
let mimetype_debug = var "mimetype_debug"
let mongo_debug = var "mongo_debug"
+let mongo_buffer_pool = var "mongo_buffer_pool"
let no_access_log = var "no_access_log"
let no_database_upgrade = var "no_database_upgrade"
let no_flood_prevention = var "no_flood_prevention"
@@ -613,6 +613,7 @@ val mimetype_debug : debug_var
display the debug for MongoDB
*)
val mongo_debug : debug_var
+val mongo_buffer_pool : debug_var
(**
{b MLSTATE_NO_ACCESS_LOG}
View
@@ -160,14 +160,15 @@ module Pool = struct
let _Kb = 1024
let _Mb = 1024 * _Kb
+ let max_total = #<If:MONGO_BUFFER_POOL> 256 #<Else> 0 #<End>
let default () = {
list = [];
total = 0;
free = 0;
- maximal_total = 1024;
- initial_size = _Kb * 4;
- dealloc_size = _Mb * 16
+ maximal_total = max_total;
+ initial_size = 128;
+ dealloc_size = 256 * _Mb / (max 1 max_total)
}
let collect () = () (*ignore(Gc.minor ())*) (* triggering gc changes almost nothing *)

0 comments on commit 8102678

Please sign in to comment.