Where is the Ruby memory configuration located and how can I check if it is installed?

In REE and MRI 1.9+, the ruby ​​garbage collector can be configured:

But none of these articles say where to place this configuration. I suppose that if this happens in the environment, a ruby ​​will pick it up when it starts, however, there is no way to verify this, as far as I can tell. Settings are not displayed in any runtime constants that I can find.

So where do I put this configuration and how can I verify that it is being used?

+5
source share
1 answer

These parameters are environment variables , so you just need to set them in the parent process of the process itself ruby. Many people recommend creating a simple shell script for this, possibly calling it /usr/local/bin/ruby-custom:

#!/bin/bash
export RUBY_HEAP_MIN_SLOTS=20000
export RUBY_HEAP_SLOTS_INCREMENT=20000
...etc...
exec "/path/to/ruby" "$@"

The first few lines set any custom variables, and the last line calls rubyitself, passing it all the arguments originally set by the script.

Then you need to mark this script as an executable ( chmod a+x /usr/local/bin/ruby-custom), and then configure Passenger to use it as an executable by rubyadding it to the Apache.conf file:

PassengerRuby /usr/local/bin/ruby-custom
+1
source

All Articles