[#38371] Re: [ruby-cvs:30538] Ruby:r23320 (trunk): * lib/set.rb (SortedSet#add): Do not let an uncomparable object — "Yugui (Yuki Sonoda)" <yugui@...>
Yuguiです。
At Mon, 4 May 2009 23:44:22 +0900,
遠藤です。
At Fri, 8 May 2009 02:00:10 +0900,
[#38372] making install-sh more descriptive — "Yugui (Yuki Sonoda)" <yugui@...>
install-shが空になって久しい(r520)です。
[#38382] [Bug #1442] indentation check and coverage for toplevel do not work — Yusuke Endoh <redmine@...>
Bug #1442: indentation check and coverage for toplevel do not work
[#38390] [Bug:1.8] Tempfile and extended Enumerable — Tanaka Akira <akr@...>
1.8.8dev で、以下のように、Enumerable に each2 を定義し、
[#38392] Enumerable#gather_each — Tanaka Akira <akr@...>
ときに、複数行をまとめて扱いたいことがあります。
ujihisaと申します。
まつもと ゆきひろです
At Sun, 10 May 2009 06:00:08 +0900,
In article <E1M2t0u-0000Aa-Sd@x61.netlab.jp>,
まつもと ゆきひろです
In article <E1M4oSd-00005c-WB@x61.netlab.jp>,
In article <873ab3531u.fsf@fsij.org>,
まつもと ゆきひろです
At Sat, 9 May 2009 15:30:20 +0900,
In article <86r5yy2nrg.knu@iDaemons.org>,
At Sun, 10 May 2009 10:08:47 +0900,
In article <86ocu132gq.knu@iDaemons.org>,
At Sun, 10 May 2009 15:57:33 +0900,
In article <86my9l2tts.knu@iDaemons.org>,
Haskell の groupBy と Python の groupby が似ている、という話
遠藤です。
In article <e0b1e5700905140800y6d701c6fj731a59ffd83b9d79@mail.gmail.com>,
[#38423] longlife gc — Narihiro Nakamura <authornari@...>
nariと申します.
[#38446] [Bug:1.9] exact Time and inexact Time — Yusuke ENDOH <mame@...>
遠藤です。
In article <e0b1e5700905132145i32bed2f0y80faef19c119824f@mail.gmail.com>,
遠藤です。
[#38463] SQLiteライブラリ — "NARUSE, Yui" <naruse@...>
成瀬です。
[#38486] [Bug #1483] some commands installed without program-suffix — Kazuhiro NISHIYAMA <redmine@...>
Bug #1483: some commands installed without program-suffix
[#38493] [Feature:trunk] enhancement of Array#drop — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
まつもと ゆきひろです
こんにちは、なかむら(う)です。
[#38518] [Bug:1.9] Enumerator.new { }.take(1).inject(&:+) causes stack overflow — Yusuke ENDOH <mame@...>
遠藤です。
[#38524] [Bug #1503] -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる — sinnichi eguchi <redmine@...>
Bug #1503: -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる
[ruby-dev:38448] GCの問題
けいじゅ@いしつかです.
添付のプログラムを実行すると. ほとんどのオブジェクト(文字列)がGCで回収
されないまま残ってしまいます.
これって, ruby側でもっと効率よくGCするようにするってことは不可能でしょ
うか?
ちなみに, コメントをはずすとゴミが回収されます.
いろんなパターンのスクリプトも添付します. Queueを使っていても同じ問題
が起こります. 1.9系だとほぼ確実に再現しますし, 1.8系だと再現する場合も
あるってかんじになっています.
--
def foo(times)
exp = []
times.times do
exp.push rand.to_s
end
exp.push nil
exp
end
def bar(exp)
while e = exp.shift
e
end
p exp
end
exp = foo(1000000)
bar(exp)
#exp = foo(100)
#bar(exp)
GC.start
count = 0
ObjectSpace.each_object(String){|s| count += 1}
puts count
--
__
---------------------------------------------------->> 石塚 圭樹 <<---
---------------------------------->> e-mail: keiju@ishitsuka.com <<---
Attachments (1)
case ARGV[0]
when "0"
require "thread"
class Exp
def initialize(out)
@output = out
@q = Queue.new
start_export
end
def push(e)
@q.push e
end
def start_export
Thread.start do
while e = @q.pop
@output.push e
end
end
end
end
class Imp
def initialize
@q = Queue.new
end
def push(e)
@q.push e
end
def pop
e = @q.pop
return e
end
end
imp = Imp.new
exp = Exp.new(imp)
1000000.times do
exp.push rand.to_s
end
exp.push "EOS"
while (e = imp.pop) != "EOS"
e
end
GC.start
count = 0
ObjectSpace.each_object(String){|s| count += 1}
puts count
when "1"
require "thread"
exp = Queue.new
1000000.times do
exp.push ""
end
exp.push "EOS"
while (e = exp.pop) != "EOS"
e
end
GC.start
count = 0
ObjectSpace.each_object(String){|s| count += 1}
puts count
when "2"
require "thread"
def foo
exp = Queue.new
1000000.times do
exp.push ""
end
exp.push "EOS"
while (e = exp.pop) != "EOS"
e
end
end
foo
GC.start
count = 0
ObjectSpace.each_object(String){|s| count += 1}
puts count
when "3"
def foo
exp = []
1000000.times do
exp.push rand.to_s
end
exp.push "EOS"
while (e = exp.shift) != "EOS"
e
end
p exp
end
foo
sleep 1
GC.start
count = 0
ObjectSpace.each_object(String){|s| count += 1}
puts count
when "4"
def foo
exp = []
1000000.times do
exp.push rand.to_s
end
exp.push "EOS"
exp
end
def bar(exp)
while (e = exp.shift) != "EOS"
e
end
p exp
end
exp = foo
bar(exp)
# exp = foo
# bar(exp)
sleep 1
GC.start
count = 0
ObjectSpace.each_object(String){|s| count += 1}
puts count
when "5"
def foo(times)
exp = []
times.times do
exp.push rand.to_s
end
exp.push nil
exp
end
def bar(exp)
while e = exp.shift
e
end
p exp
end
exp = foo(1000000)
bar(exp)
#exp = foo(100)
#bar(exp)
sleep 1
GC.start
count = 0
ObjectSpace.each_object(String){|s| count += 1}
puts count
when "6"
def foo(times)
exp = []
times.times do
exp.push rand.to_s
end
exp.push "EOS"
exp
end
def bar(exp)
while (e = exp.shift) != "EOS"
e
end
p exp
end
t1 = Thread.start {
exp = foo(1000000)
bar(exp)
exp = foo(100)
bar(exp)
}
t2 = Thread.start {
exp = foo(1000000)
bar(exp)
exp = foo(100)
bar(exp)
}
# exp = foo
# bar(exp)
t1.join
t2.join
GC.start
count = 0
ObjectSpace.each_object(String){|s| count += 1}
puts count
end