Memory leak?

Hi,

Does anyone see anything here,

for case_number in 1…NUMBER_OF_CASES
case_dir = File.join( ‘Cases’, ‘Case’ ) +
case_number.to_s.rjust(5,“0”)
mkdir_p case_dir
ln_sf LINK_FILES, case_dir unless LINK_FILES.empty?
cp COPY_FILES, case_dir unless COPY_FILES.empty?
cd case_dir do
fuzzy_contents.each do |original_name, fuzzy_content|
File.open(original_name,‘w’){ |f| f.puts fuzzy_content.sample }
end
end
$stdout.print ‘.’; $stdout.flush
end

that should cause a steady growth in memory?

It works fine for 5,000 cases; but by about 10,000 cases,
the process exceeds 2GB!

Thanks,

Bil K. wrote:

Does anyone see anything here,

[…]

that should cause a steady growth in memory?

It works fine for 5,000 cases; but by about 10,000 cases,
the process exceeds 2GB!

Doh! Nevermind, fuzzy_content.sample contains an array push:

(@fields[tag] ||= []) << sample

I guess it is time to look at persisting to the file system
instead of storing everything in memory…

Later,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs