[#3536] Re: [ruby-list:10256] Re: for が修飾子だったら — Junichi Kurokawa <jun@...>

Reply-To: ruby-devとしました。

15 messages 1998/10/22

[ruby-dev:3563] Re: ([nil]*i).compact bug?

From: Kazuhiro HIWADA <hiwada@...>
Date: 1998-10-31 13:32:38 UTC
List: ruby-dev #3563
ひわだです。

ひわだ> % ruby -e "p [nil, nil].compact"
ひわだ> ruby in realloc(): warning: chunk is already free.

ひわだ> #freebsd2.2.2 がまずいのかも。

man realloc をみたところ freebsd2.2.2 では size が 0 だとfreeしたうえ
で null pointer を返してくれるみたいです。freebsd2.2.7 では null が返っ
たりしないみたいなんですが。

とりあえず、freebsd2.2.2では以下で動いてます ^^;。

--- gc.c.orig   Sat Oct 31 21:54:38 1998
+++ gc.c        Sat Oct 31 22:06:24 1998
@@ -97,7 +97,7 @@
     if (!ptr) return xmalloc(size);
     malloc_memories += size;
     mem = realloc(ptr, size);
-    if (!mem) {
+    if (!mem && size) {
        gc_gc();
        mem = realloc(ptr, size);
        if (!mem)

In This Thread