summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-12-29 02:47:07 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-12-29 02:47:07 +0000
commit4c1441870edd4279699a672024332ee309a6c87e (patch)
treefb6e749450b8bbbe33031daa2bdcfb0c7b61d626 /gc.c
parent2cafd39ed2bd164ece3468393300684f2da19902 (diff)
* gc.c (mem_error): prohibit recursive mem_error().
(ruby-bugs-ja:PR#36) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 0460cf5..589813f 100644
--- a/gc.c
+++ b/gc.c
@@ -53,10 +53,17 @@ static void
mem_error(mesg)
char *mesg;
{
+ static int recurse = 0;
+
if (rb_safe_level() >= 4) {
rb_raise(rb_eNoMemError, mesg);
}
- rb_fatal(mesg);
+ if (recurse == 0) {
+ recurse++;
+ rb_fatal(mesg);
+ }
+ fprintf(stderr, "[FATAL] failed to allocate memory\n");
+ exit(1);
}
void *