From: Kikutani Makoto Date: 1998-05-07T12:36:40+09:00 Subject: [ruby-list:7838] pop3-lib --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit きくたにです。 立石さんの popmail.rb(さっき取ってきたのでたぶん最新) を試しているのですが、 get 46 (local filename 46). get 47 (local filename 47). get 48 (local filename 48). get 49 (local filename 49). close socket. ./pop3-lib.rb:73:in +': failed to allocate memory (fatal) from ./pop3-lib.rb:73:in gets2' from ./pop3-lib.rb:171:in get_mail' from popmail.rb:168 from popmail.rb:167:in each' from popmail.rb:167 となってしまいます。該当ソースは message = message + "\n" + line というところです。50番目のメッセージは 1200行(80KB) くらいですが、 これで failed to allocate memory になるものでしょうか? そこで、添付のようにmessageをarrayに換えてやってみたら、 ここは通りました。速くなった気もします。 But、POPのスプールにはテスト用に25000行(1.8MB)なんてメッセージも あるんですが、さすがにそこでこけてしまいました。 ちょっと厳しすぎるテストかもしれませんが報告まで。 # ruby 1.1b9_16(98/04/28) [i586-linux] -- 人生を背負い投げ 菊谷 誠(Kikutani Makoto) kikutani@gol.com kikutani@debian.or.jp (Linux関係のみ) --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pop3-lib.rb.pat" --- pop3-lib.rb.orig Thu May 7 12:27:55 1998 +++ pop3-lib.rb Thu May 7 12:28:00 1998 @@ -63,14 +63,15 @@ if( line == "." ) loop = false else - message = line + message = [] + message << line end while( loop ) line = gets if( line == "." ) loop = false else - message = message + "\n" + line + message << line end end return message @@ -145,13 +146,12 @@ ans = gets if( ok?(ans) ) if ( msg = gets2 ) - msglist = msg.split("\n") - for line in msglist + msg.each{|line| linelist = line.split(/ +/) if( linelist[0] != nil ) maillist.push(linelist[0]) end - end + } end else maillist = nil --6c2NcOVqGQ03X4Wi--