Permalink
Browse files

Disabled Ruby's garbage collector (memory leak, but no crashes).

  • Loading branch information...
1 parent d5f98c8 commit 4b884f10233873b486a17e65dfd2f6c00d1a99d2 @max99x max99x committed Sep 15, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 entry_point.js
View
@@ -11,7 +11,13 @@ this['Ruby'] = {
// Wheee, infinite stack!
var variable_in_this_stack_frame = allocate(4, 'i32', ALLOC_STACK);
_ruby_init_stack(variable_in_this_stack_frame);
- _ruby_stack_check = function () { return false; };
+ // The Ruby garbage collector is currently incompatible with Emscripten, so
+ // we disable it completely. This causes memory leaks, but prevents crashes.
+ // TODO: Get the garbage collector to work (maybe stack direction issues?).
+ // Requires #define C_ALLOCA 1 for a start (garbage_collect llvm bug).
+ _rb_gc_disable();
+ _rb_gc_enable = function () { return 0; };
+ _ruby_stack_check = function () { return 0; };
_ruby_init();
var includeStr = Ruby.allocateString('.');

0 comments on commit 4b884f1

Please sign in to comment.