title: Getting error "Cannot allocate memory" for Rails
body: <p>In my project there is one script that returns the list of products which I have to display in a table. </p>
  
  <p>To store the input of the script I used <code>IO.popen</code>:</p>
  
  <pre><code>@device_list = []
  IO.popen("device list").each do |device|
    @device_list &lt;&lt; device
  end
  </code></pre>
  
  <p><code>device list</code> is the command that will give me the product list.</p>
  
  <p>I  return the <code>@device_list</code> array to my view for displaying by iterating it.</p>
  
  <p>When I run it I got an error:</p>
  
  <pre><code>Errno::ENOMEM (Cannot allocate memory):
  for IO.popen
  </code></pre>
  
  <p>I have on another script <code>device status</code> that returns only true and false but I got the same error:</p>
  
  <pre><code>def check_status(device_id)        
      @stat = system("status device_id")
      if @stat == true
           "sold"
      else
           "not sold"
      end
    end
  </code></pre>
  
  <p>What should I do?</p>