From: Shigeo Kobayashi Date: 2000-02-05T21:39:55+09:00 Subject: [ruby-dev:9126] Re: xmalloc() in Windows 小林です。 ----- Original Message ----- 送信者 : Yukihiro Matsumoto 件名 : [ruby-dev:9107] Re: xmalloc() in Windows > |「xmalloc() で割り当てたメモリは全て xfree() で開放する」 > |と変更させてください。 > > で、私にはあんまり「やる気」がないんで、どなたかが率先してやっ > ていただけると採用されるんではないかと。これがオープンソース。 > なるほど。。。 以下のようなプログラムを作成しました。適用+再ビ ルドして、簡単なテストでは OK です。 gc.c 内の xfree() と xmalloc() は手で編集する必要が ありますが... あとは、xmalloc() 内で GC や例外を呼ぶと不都合が 生じるコンテキストがあるかということですか... それにしても、gc.c 内の xfree() をみると、もともと xmalloc() とペアで使用するような意図があったような 気がするのですが(カウントしているし)? # # After execution,be sure to change xfree() called in # xfree() to free() avoiding infinite recursive call # in gc.c. # Same as xmalloc() call in xmalloc(). # Dir.foreach (".") do |file| if /\.c$|\.h$|\.y$/ =~ file if FileTest::exist?(file+".old")==false print "Processing:",file,"\n" File::rename(file,file+".old") in_file = open(file+".old", "r") out_file = open(file, "w") while line = in_file.gets line.gsub!(/(\s)free\(/,'\1xfree(') line.gsub!(/(\s)malloc\(/,'\1xmalloc(') out_file.puts(line) end in_file.close out_file.close end end end exit 小林 茂雄 E-Mail: shigeo@tinyforest.gr.jp Home Page: http://www.tinyforest.gr.jp