A
A
artem_music2016-02-04 16:03:01
Ruby on Rails
artem_music, 2016-02-04 16:03:01

Errno::ENOMEM - rails out of memory to process CSS?

I'm building a website for RoR, the following error occurs periodically:

Errno::ENOMEM in Pages#index
Cannot allocate memory - node
(in /var/www/html/my_app/app/assets/stylesheets/pages.css.scss)

and highlighted in red is this line in application.html.erb:
<%= stylesheet_link_tag "pages" %>

There is still memory on the server (about 140 MB + free SWAP), what could be the matter? How to treat it?
UPD: The problem went away after manually including CSS in /views/layouts/application.html.erb, having previously compiled it from SCSS on the local machine. But I feel that this is a crutch solution. In general, there is not enough memory to compile the SCSS file to the system for some reason, perhaps the reason is that the file is large? (2900 lines)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
artem_music, 2016-03-16
@artem_music

The problem was solved by precompiling css and js (rake:precompile). There was not enough RAM to generate aggregated styles and scripts on the fly.

R
Roman Mirilaczvili, 2016-02-05
@2ord

All in all, according to the Gemfile provided, it looks like there is an excessive amount of gems being used.
All of them, unsurprisingly, consume memory in one way or another, which eventually becomes the scapegoat for SCSS preprocessing.

  1. The most logical thing seems to me to reduce the number of dependencies.
  2. In addition, memory consumption can increase precisely with certain gem settings.
  3. Optimization of application memory consumption by the profiler.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question