Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Add this to your app/controllers/application_controller.rb
# Log GC stats, if enabled (make this the first before_filter)
before_filter :before_log_gc_stats
# Log GC stats, if enabled (make this the last after_filter)
after_filter :after_log_gc_stats
def before_log_gc_stats
return if (ENV['RUBY_GC_STATS'].nil? or ENV['RUBY_GC_STATS'] != '1')
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
int main(int argc, char* argv[]) {
setenv("RUBY_HEAP_MIN_SLOTS", "650000", 0);
setenv("RUBY_GC_MALLOC_LIMIT", "50000000", 0);