Skip to content

Commit

Permalink
significantly reduce ruby memory usage by setting default env variabl…
Browse files Browse the repository at this point in the history
…e MALLOC_ARENA_MAX=2 (#663)

* add ruby default env variable to reduce memory usage MALLOC_ARENA_MAX=2

* update tests
  • Loading branch information
flybayer authored Nov 7, 2022
1 parent e541cbd commit 3dbc402
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/providers/ruby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ impl RubyProvider {
"GEM_HOME".to_string(),
format!("/usr/local/rvm/gems/{}", ruby_version),
),
("MALLOC_ARENA_MAX".to_string(), "2".to_string()),
]);
if self.is_rails_app(app) {
env_vars.insert("RAILS_LOG_TO_STDOUT".to_string(), "enabled".to_string());
Expand Down
1 change: 1 addition & 0 deletions tests/snapshots/generate_plan_tests__ruby.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ expression: plan
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/rvm/gems/ruby-3.1.2",
"GEM_PATH": "/usr/local/rvm/gems/ruby-3.1.2:/usr/local/rvm/gems/ruby-3.1.2@global",
"MALLOC_ARENA_MAX": "2",
"NIXPACKS_METADATA": "ruby"
},
"phases": {
Expand Down
1 change: 1 addition & 0 deletions tests/snapshots/generate_plan_tests__ruby_execjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ expression: plan
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/rvm/gems/ruby-3.1.2",
"GEM_PATH": "/usr/local/rvm/gems/ruby-3.1.2:/usr/local/rvm/gems/ruby-3.1.2@global",
"MALLOC_ARENA_MAX": "2",
"NIXPACKS_METADATA": "ruby"
},
"phases": {
Expand Down
1 change: 1 addition & 0 deletions tests/snapshots/generate_plan_tests__ruby_local_deps.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ expression: plan
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/rvm/gems/ruby-3.1.2",
"GEM_PATH": "/usr/local/rvm/gems/ruby-3.1.2:/usr/local/rvm/gems/ruby-3.1.2@global",
"MALLOC_ARENA_MAX": "2",
"NIXPACKS_METADATA": "ruby"
},
"phases": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ expression: plan
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/rvm/gems/3.1.2",
"GEM_PATH": "/usr/local/rvm/gems/3.1.2:/usr/local/rvm/gems/3.1.2@global",
"MALLOC_ARENA_MAX": "2",
"NIXPACKS_METADATA": "ruby",
"RAILS_LOG_TO_STDOUT": "enabled"
},
Expand Down
1 change: 1 addition & 0 deletions tests/snapshots/generate_plan_tests__ruby_sinatra.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ expression: plan
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/rvm/gems/ruby-3.1.2",
"GEM_PATH": "/usr/local/rvm/gems/ruby-3.1.2:/usr/local/rvm/gems/ruby-3.1.2@global",
"MALLOC_ARENA_MAX": "2",
"NIXPACKS_METADATA": "ruby"
},
"phases": {
Expand Down
1 change: 1 addition & 0 deletions tests/snapshots/generate_plan_tests__ruby_with_node.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ expression: plan
"BUNDLE_GEMFILE": "/app/Gemfile",
"GEM_HOME": "/usr/local/rvm/gems/ruby-3.1.2",
"GEM_PATH": "/usr/local/rvm/gems/ruby-3.1.2:/usr/local/rvm/gems/ruby-3.1.2@global",
"MALLOC_ARENA_MAX": "2",
"NIXPACKS_METADATA": "ruby"
},
"phases": {
Expand Down

0 comments on commit 3dbc402

Please sign in to comment.