From: Roger Pack Date: 2007-10-20T10:28:38+09:00 Subject: memory corruption Wondering if anybody's had memory corruption with mingw before. This works fine for VC and for Linux (it's just some base rails code). Anyway somehow or other it gets corrupted and inserts random bytes into a "Buffer" like \000 and EOF and random junk. It occurs in thsi snippet of erb.rb code. Any help appreciated :) -Roger scanner.scan do |token| if scanner.stag.nil? pp "token", token pp "out", out case token when PercentLine out.push("#{@put_cmd} #{content.dump}") if content.size > 0 content = '' out.push(token.to_s) out.cr when :cr out.cr when '<%', '<%=', '<%#' scanner.stag = token out.push("#{@put_cmd} #{content.dump}") if content.size > 0 content = '' when "\n" content << "\n" out.push("#{@put_cmd} #{content.dump}") out.cr content = '' when '<%%' content << '<%' else content << token end else case token when '%>' case scanner.stag when '<%' if content[-1] == ?\n content.chop! out.push(content) out.cr else out.push(content) end when '<%=' out.push("#{@insert_cmd}((#{content}).to_s)") when '<%#' # out.push("# #{content.dump}") end scanner.stag = nil content = '' when '%%>' content << '%>' else content << token end end end out.push("#{@put_cmd} #{content.dump}") if content.size > 0 pp "out is", out out.close out.script -- Posted via http://www.ruby-forum.com/.