Hello! In PHP there is such a construction: ini_set('memory_limit', '128M'); How to implement this in Ruby?

  • one
    Don't need to drag anything from PHP into Ruby, please. - Vlad Lisovsky

2 answers 2

And what should this option specifically do, fly out with NoMemoryError? If you want the process to end when it eats up too much memory, use monitoring tools that will restart memory-consuming processes. Cpulimit can help deal with processor limitation.

  • As far as I remember, the plus of this option in php can be that php is not killed and throws out an extract that can be caught and responded to by the script. But what does the author mean ... - Chad

I see no point in controlling the amount of memory allocated from the code of a simple application. If not worth such a task, of course. Select a dynamic server to your liking (Unicorn, Puma, Thin) and write its behavior and memory size in the config file. Gitkhabovsky best praktis .