File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
lib/async/container/supervisor Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -13,18 +13,22 @@ class MemoryMonitor
1313 # Create a new memory monitor.
1414 #
1515 # @parameter interval [Integer] The interval at which to check for memory leaks.
16- # @parameter limit [Integer] The limit of memory that a process can consume before being killed .
17- def initialize ( interval : 10 )
16+ # @parameter total_size_limit [Integer] The total size limit of all processes, or nil for no limit .
17+ def initialize ( interval : 10 , total_size_limit : nil , ** options )
1818 @interval = interval
19- @cluster = Memory ::Leak ::Cluster . new ( limit : limit )
19+ @cluster = Memory ::Leak ::Cluster . new ( total_size_limit : total_size_limit )
20+
21+ # We use these options when adding processes to the cluster:
22+ @options = options
23+
2024 @processes = Hash . new { |hash , key | hash [ key ] = Set . new . compare_by_identity }
2125 end
2226
2327 # Add a process to the memory monitor. You may override this to control how processes are added to the cluster.
2428 #
2529 # @parameter process_id [Integer] The process ID to add.
2630 def add ( process_id )
27- @cluster . add ( process_id )
31+ @cluster . add ( process_id , ** @options )
2832 end
2933
3034 # Remove a process from the memory monitor.
You can’t perform that action at this time.
0 commit comments