Skip to content

Instantly share code, notes, and snippets.

@bogn83
Forked from wevtimoteo/flags.rb
Created March 19, 2020 17:30
Show Gist options
  • Save bogn83/40ac232b058ef162812df556f141c58b to your computer and use it in GitHub Desktop.
Save bogn83/40ac232b058ef162812df556f141c58b to your computer and use it in GitHub Desktop.
Ruby Flags
# Flags Ruby
# Sentinel to check that the rbenv-vars plugin is in use.
RBENV_VARS_ENABLED=1
# Ruby 2.1 GC reading:
# http://tmm1.net/ruby21-rgengc/
# http://thorstenball.com/blog/2014/03/12/watching-understanding-ruby-2.1-garbage-collector/
# http://samsaffron.com/archive/2013/11/22/demystifying-the-ruby-gc
# Trigger GC when this malloc threshold is reached.
# Defaults to 8MB.
#
# Set to 384MB based on our runtime RSS.
#RUBY_GC_MALLOC_LIMIT=8388608
#RUBY_GC_MALLOC_LIMIT=262144000
RUBY_GC_MALLOC_LIMIT=402653184
# Cap malloc limit growth.
# Defaults to 32MB with 1.4x growth factor.
# Ruby 2.1 only.
#
# Bump to max 64MB limit increase.
#RUBY_GC_MALLOC_LIMIT_MAX=33554432
#RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=1.4
RUBY_GC_MALLOC_LIMIT_MAX=67108864
# Initial number of heap slots.
# Defaults to 10000 slots.
# Ruby 2.1 renames RUBY_HEAP_MIN_SLOTS to RUBY_GC_HEAP_INIT_SLOTS.
#
# We use about 1600000 slots to boot up.
RUBY_GC_HEAP_INIT_SLOTS=1800000
# In Ruby < 2.1, triggers heap growth if < free_min slots are left after GC.
# In Ruby >= 2.1, ensures at least N slots are free after GC.
# Defaults to 4096 slots.
# Ruby 2.1 renames RUBY_FREE_MIN to RUBY_GC_HEAP_FREE_SLOTS.
#
# Tune this such that a GC leaves enough heap slots to serve N more requests
# before another full GC is needed.
RUBY_GC_HEAP_FREE_SLOTS=1000000
# Increase heap pages by (factor - 1) * pages_used.
# Defaults to 1.8.
# Ruby 2.1 only.
#
# Decrease to 1.3 to limit growth of huge heaps.
#RUBY_GC_HEAP_GROWTH_FACTOR=1.8
RUBY_GC_HEAP_GROWTH_FACTOR=1.3
# Cap the number of heap slots to grow.
# Defaults to 0: no max.
# Ruby 2.1 only.
#RUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
# Trigger full GC when oldobject count is > this factor * count of oldobjects
# after last full GC.
# Defaults to 2x.
#
# Lower to 1.3 to perform full GC more often as oldobjects grow, limiting
# huge heap growth when number of long-lived objects increases quickly.
#RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=2
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.3
# Trigger full GC when oldmalloc is exhausted.
# Defaults to min 16MB up to 128MB max with 1.2x growth factor.
#RUBY_GC_OLDMALLOC_LIMIT=16777216
RUBY_GC_OLDMALLOC_LIMIT=67108864
# Cap the size of oldmalloc growth.
# Defaults to 128MB.
#RUBY_GC_OLDMALLOC_LIMIT_MAX=134217728
# Increase oldmalloc limit by this factor when exhausted.
# Defaults to 1.2x.
#RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment