resources/memory/weight_balancing_memory_heuristic.rb
# Creates an instance based on a hash containing memory settings, and the application's memory size in
# $MEMORY_LIMIT.
#
# @param [Hash<String, String>] sizes any sizes specified by the user
# @param [Hash<String, Numeric>] heuristics the memory heuristics specified by the user
# @param [Array<String>] valid_types the valid types of memory
# @param [Hash<String, String>] java_opts a mapping from a memory type to a +JAVA_OPTS+ option
Creates an instance based on a hash containing memory settings, and the application's memory size in
$MEMORY_LIMIT.
Creates an instance based on a hash containing memory settings and the application ' s memory size in $MEMORY_LIMIT .
def balance_remainder(remaining_buckets, remaining_memory)
    deleted         = false
    total_weighting = calculate_total_weighting remaining_buckets
    allocated_memory = MemorySize::ZERO
    remaining_buckets.each do |type, bucket|
      size = apply_weighting(remaining_memory, bucket, total_weighting)
      if bucket.range.contains? size
        bucket.size = size
      else
        allocated_memory = constrain_bucket_size(allocated_memory, bucket, size)
        remaining_buckets.delete type
        deleted = true
      end
    end
    remaining_memory -= allocated_memory
    raise "Total memory #{@memory_limit} exceeded by configured memory #{@sizes}" if remaining_memory < 0
    [remaining_memory, deleted]
  end
def balance_remainder ( remaining_buckets , remaining_memory ) deleted = false total_weighting = calculate_total_weighting remaining_buckets allocated_memory = MemorySize :: ZERO remaining_buckets . each do | type , bucket | size = apply_weighting ( remaining_memory , bucket , total_weighting ) if bucket . range . contains? size bucket . size = size else allocated_memory = constrain_bucket_size ( allocated_memory , bucket , size ) remaining_buckets . delete type deleted = true end end remaining_memory -= allocated_memory raise "Total memory #{@memory_limit} exceeded by configured memory #{@sizes}" if remaining_memory < 0 [ remaining_memory , deleted ] end
Creates an instance based on a hash containing memory settings, and the application's memory size in
$MEMORY_LIMIT.
Creates an instance based on a hash containing memory settings and the application ' s memory size in $MEMORY_LIMIT .
remaining_buckets
remaining_memory
java_opts a mapping from a memory type to a +JAVA_OPTS+ option
java_opts a mapping from a memory type to a + JAVA_OPTS + option