Wednesday, May 9, 2012

[Rails] Re: out of memory (java heap space) on zip creation (jruby)

> The heap contains all the objects created for the application.. In this
> case, it looks like your file is still too big
>
> > Error occurred during initialization of VM
> > Could not reserve enough space for object heap
> > JVM creation failed
>
> This means that you tried to allocate more than is available on the machine
>
> Are you doing this for a single load, or will it be an application that
> will commonly receive large files?
>
> If it's the latter, I'd probably try to redesign the code you're using to
> load the files.  Sounds like this is part of a third party gem?  If that's
> the case, maybe they have some mechanism for handling larger files?
>
> --
> Greg Akinshttp://twitter.com/akinsgre

What I do is create a csv file from the database. I had some memory
problems there, but using active record find_in_batches() seemed to
solve that.

The CSV file has 1.4 million rows. It gets created successfully. I
then use rubyzip gem to create a zip file that just contains that CSV
file. I just used examples I found from google searches on how to
create the zip file which are shown earlier up in the thread. I looked
at the class info on the web for rubyzip and didn't see an obvious way
to stream data into the zip file. Tomorrow I can look at perhaps some
other way to create a zip file using a different gem or some such ..



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate