From: zarawesome@... Date: 2004-11-30T11:17:49+09:00 Subject: multiple rb_require()s causing segmentation fault Greetings, I have been running into trouble with Ruby 1.8.1. I have created the following code to load several files of code to the program: // -------------------- code follows char *filename_safe_require; VALUE SafeRequire(VALUE arg) { return rb_require(filename_safe_require); } void ScriptLoadFile(char *filename) { filename_safe_require=filename; VALUE info; int error = 0; rb_protect((unsigned long (__cdecl *)(unsigned long))SafeRequire, 0, &error); if(error) { rb_backtrace(); info = rb_inspect(ruby_errinfo); Log("ERROR %s\n", STR2CSTR(info)); return; } [...other code...] } int main(int argc, char *argv[]) { ruby_init(); ruby_init_loadpath(); ruby_script("embedded"); [Prepares classes for use in Ruby code] ScriptLoadFile("scripts/player.rb", ""); ScriptLoadFile("scripts/enemy.rb", ""); ScriptLoadFile("scripts/boss.rb", ""); ScriptLoadFile("scripts/maps.rb", ""); ScriptLoadFile("scripts/objects.rb", ""); [...other code...] } // -------------------- code ends The problem is, now, adding some lines to, say, enemy.rb will make the program core dump while reading the -next- file. For example, adding a line as prosaic as '$global=0' to a class function definition in enemy.rb will crash it. However, removing every other class from the enemy.rb file and adding that line works just fine. I am under the impression that I'm hitting some kind of memory limit. Is Ruby to blame or my program? Is there a way to check on this?