On Wednesday, May 9, 2012 1:52:27 PM UTC-3, Jedrin wrote:
>
> I am using rubyzip and am trying to put a huge csv file with 1.4 
> million rows into the zip file. 
> Using jruby I get a out of heap error. 
>
> I believe the error happens in the block below: 
>
>     Zip::ZipOutputStream.open(zip_path) do |zos| 
>       zos.put_next_entry(File.basename(csv_path)) 
>       zos.print IO.read(csv_path) 
>     end 
>

You're reading the entire file contents into memory and then saving.

Look if there is a way for you to stream chunks (16 kilobytes for example) 
into the zip stream.

 --
Luis Lavena

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/pd99kWagyskJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to