No Memory Error Failed To Allocate Memory
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have
Ruby Nomemoryerror
Meta Discuss the workings and policies of this site About Us nomemoryerror failed to allocate memory rails Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with
Chef Error Nomemoryerror Failed To Allocate Memory
us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just failed to allocate memory ruby on rails like you, helping each other. Join them; it only takes a minute: Sign up 'Failed to allocate memory' error with large array up vote 2 down vote favorite I am trying to import a large text file (approximately 2 million rows of numbers at 260MB) into an array, make edits to the array, and then write the ruby memory allocation results to a new text file, by writing: file_data = File.readlines("massive_file.txt") file_data = file_data.map!(&:strip) file_data.each do |s| s.gsub!(/,.*\z/, "") end File.open("smaller_file.txt", 'w') do |f| f.write(file_data.map(&:strip).uniq.join("\n")) end However, I have received the error failed to allocate memory (NoMemoryError). How can I allocate more memory to complete the task? Or, ideally, is there another method I can use where I can avoid having to re-allocate memory? ruby arrays memory-management share|improve this question edited Jan 21 '15 at 13:22 daniula 4,61941434 asked Jan 21 '15 at 13:16 Matt K 205 1 If I were you I'd focus on making this more incremental - there's no need to read the whole file in one go. –Frederick Cheung Jan 21 '15 at 13:19 As @FrederickCheung advises, you should be reading the input file one line at a time. You can do that with IO#foreach: IO.foreach("input_file") do |line| ... end. Transform line in the block and then append that to the output file. –Cary Swoveland Jan 21 '15 at 13:5
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or
Ruby Memory Limit
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up no memory error, failed to allocate memory up vote 0 down vote favorite I'm new in Ruby On Rails but each time I make a mistake (in a function for instance), my computer (xubuntu 10.10) totally http://stackoverflow.com/questions/28068226/failed-to-allocate-memory-error-with-large-array freezes. Actually I can't do anything except waiting and I finally got an "No memory error -> failed to allocate memory" error after 5 or 10 minutes. I use rails 3 and mongoDB. I'm developping from an existing project with many gems, is there any consequences ? Thank you ! ruby-on-rails ruby ruby-on-rails-3 rubygems share|improve this question asked Jul 18 '11 at 13:41 Max 5191622 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote Possible diagnosis: http://stackoverflow.com/questions/6733814/no-memory-error-failed-to-allocate-memory you are using Ruby installed from ubuntu packages you have bad physical ram These days it's good practice to install your rubies through RVM: http://beginrescueend.com/ If you want to test if you RAM is bad try memtest86: http://www.memtest86.com/ I'd go with installing RVM. share|improve this answer answered Jul 18 '11 at 14:00 kain 3,91311633 I've just tested the RAM -> OK I've removed completely ruby and rails from xubuntu and I've followed your RVM tuto -> OK But it's exactly the same, my project on localhost is extremely slow... –Max Jul 22 '11 at 10:43 add a comment| up vote 1 down vote Update your Ruby version Run memtest to perform hardware memory test share|improve this answer answered Jul 21 '11 at 17:09 Anatoly 8,94622949 did you have a chance to run memtest? Ubuntu has it by default in menu bootlist –Anatoly Jul 22 '11 at 2:42 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged ruby-on-rails ruby ruby-on-rails-3 rubygems or ask your own question. asked 5 years ago viewed 3342 times active 5 years ago Get the weekly new
Sign in Pricing Blog Support Search GitHub This https://github.com/misshie/bioruby-ucsc-api/issues/5 repository Watch 3 Star 16 Fork 8 misshie/bioruby-ucsc-api Code Issues 1 Pull requests 0 Projects 0 Pulse Graphs New issue NoMemoryError: failed http://www.redmine.org/boards/1/topics/47468 to allocate memory #5 Closed spheregenomics opened this Issue Mar 25, 2014 · 11 comments Projects None yet Labels None yet failed to Milestone No milestone Assignees No one assigned 2 participants spheregenomics commented Mar 25, 2014 I have been using this gem for some time with no problems. Suddenly it cannot allocate memory. I tried upgrading to 0.6.1 but it did not make a failed to allocate difference. Rails 4.0.2 ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux] 1.9.1 :003 > seqfile = Ucsc::File::Twobit.open("/home/assay/apps/assay/shared/bin/hg19/hg19.2bit") NoMemoryError: failed to allocate memory from /home/assay/apps/assay/shared/bundle/ruby/1.9.1/gems/bio-ucsc-api-0.6.1/lib/bio-ucsc/file/twobit.rb:37:in `read' from /home/assay/apps/assay/shared/bundle/ruby/1.9.1/gems/bio-ucsc-api-0.6.1/lib/bio-ucsc/file/twobit.rb:37:in `block in load' from /home/assay/apps/assay/shared/bundle/ruby/1.9.1/gems/bio-ucsc-api-0.6.1/lib/bio-ucsc/file/twobit.rb:37:in `open' from /home/assay/apps/assay/shared/bundle/ruby/1.9.1/gems/bio-ucsc-api-0.6.1/lib/bio-ucsc/file/twobit.rb:37:in `load' from /home/assay/apps/assay/shared/bundle/ruby/1.9.1/gems/bio-ucsc-api-0.6.1/lib/bio-ucsc/file/twobit.rb:59:in `open' from (irb):3 from /home/assay/apps/assay/shared/bundle/ruby/1.9.1/gems/railties-4.0.2/lib/rails/commands/console.rb:90:in `start' from /home/assay/apps/assay/shared/bundle/ruby/1.9.1/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in `start' from /home/assay/apps/assay/shared/bundle/ruby/1.9.1/gems/railties-4.0.2/lib/rails/commands.rb:62:in `
on a fresh ubuntu 15.04 x64 server. When I try to create new users by clicking on the new user link, I get an Internal Error page. The production.log shows the following: Started GET "/redmine/users/new" for 10.0.0.205 at 2015-06-03 09:42:50 +0200Processing by UsersController#new as HTML Current user: admin (id=1) Rendered users/_mail_notifications.html.erb (7.2ms) Rendered users/_preferences.html.erb (82.0ms) Rendered users/_form.html.erb (224.0ms) Rendered users/new.html.erb within layouts/admin (247.8ms)Completed 500 Internal Server Error in 257ms NoMemoryError (failed to allocate memory): lib/redmine/views/labelled_form_builder.rb:42:in `time_zone_select' app/views/users/_preferences.html.erb:3:in `block in app_views_users_preferences_html_erb___1748119273592504295_73151720' app/helpers/application_helper.rb:1051:in `labelled_fields_for' app/views/users/_preferences.html.erb:1:in `_app_views_users__preferences_html_erb___1748119273592504295_73151720' app/views/users/_form.html.erb:50:in `_app_views_users__form_html_erb__289902795039997432_72080440' app/views/users/new.html.erb:4:in `block in app_views_users_new_html_erb__1177077495837321045_72013680' app/helpers/application_helper.rb:1044:in `labelled_form_for' app/views/users/new.html.erb:3:in `_app_views_users_new_html_erb___1177077495837321045_72013680' Any help would be appreciated please. Thanks Replies (5) RE: Cannot create users - Added by Toshi MARUYAMA over 1 year ago Travis Starke wrote: NoMemoryError (failed to allocate memory): RE: Cannot create users - Added by Toshi MARUYAMA over 1 year ago #20064. RE: Cannot create users - Added by Travis Starke over 1 year ago I thought the same until I checked the memory usage of the server and there is about +- 1.8GB RAM available, when I monitor real time memory usage and try add a user, it hardly makes a change. RE: Cannot create users - Added by Toshi MARUYAMA over 1 year ago Try https://github.com/tzinfo/tzinfo/issues/30#issuecomment-57902029. Create Gemfile.local, add "gem 'tzinfo-data'" to it and run "bundle update" or "bundle install".If it does not resolve problem, it causes by ubuntu or tzinfo gem. RE: Cannot create users - Added by Travis Starke over 1 year ago Awesome, its working now. I ran into problems updating the mysql12 and rmagick gems. Running the following problems with th