Skip to content
This repository
Newer
Older
100644 35 lines (30 sloc) 1.615 kb
4e4cc9dd » OpaOnWindowsNow
2012-05-30 [fix] http,buffer pool: merge http and mongo buffer pool codes
1 (*
2 Copyright © 2011, 2012 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (** A pool of element (for short lives element with high allocation cost).
19 It diverges to standard allocation (pure GC) when the pool too small.
20 Performance gains (vs standard) are not huge (at most 15% on persistant db actors)
21 Detection of unused element is based on finalise (i.e. depends on GC),
22 which can explain that the gain is small compared to pure GC. (element are not recycled immediatly)
23 Can retain unsued memory (pool are originally bounded to 256 Mb per pool).
24 By default the pool size is zero (disabled) (set MLSTATE_BUFFER_POOL to activate).
25 Element must be heap allocated and must not be an array of float or a record of float.
26 *)
27 module Pool : functor (Egg:Egg.Egg) -> sig
28 type pool
29 type size = int
30 val bound_cardinal_and_total_size : pool -> cardinal:int -> total_size:size -> unit
31 val create : unit -> pool
32 val alloc : pool -> ?hint:size -> unit -> Egg.egg
33 end
34
35 module BufferEgg : Egg.Egg with type egg = Buf.t
Something went wrong with that request. Please try again.