AFAIK , On production mode, rails has a default configuration called
"eager_load" ( config.eager_load ) . This loads all the classes into the
RAM for faster access( cache ) . But for b1 = Book.new, b2 = Book.new , The
class and methods are not loaded twice. The object is created and occupies
RAM.

Also note that how huge is your RAM vs how huge is your code base and the
libraries your app loads. take a look at this to understand more about
this.

http://blog.plataformatec.com.br/2012/08/eager-loading-for-greater-good/



On Fri, Nov 28, 2014 at 7:54 AM, Karthikeyan A K <[email protected]> wrote:

> Hello Folks,
>
> Have a doubt. I am in  a project where Model gets bigger and bigger. Yes
> we are breaking up into concerns, but what we are not sure of is weather
> this code will get included in RAM when we call say b = Book.new or
> something, thus making the Rails app occupy more memory.
>
> The most bulk of the model come from adding tasks that runs in background
> (which will be called like book.scan ), like scanning a book and creating
> text from OCR. So Should I have these background tasks as separate class
> somewhere in lib, or is it okay to have it in concerns?
>
> Will ruby load all the functions of a model into RAM when its called or it
> loads a function only if its called?
>
> ----
>
> Karthikeyan A K
> http://rails7.wordpress.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/CAJR%2B9kYpX5S_HtiN43FVESeX8mu6%3DAKz11z41%3D%3DxzjYff%3DyG1g%40mail.gmail.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/CAJR%2B9kYpX5S_HtiN43FVESeX8mu6%3DAKz11z41%3D%3DxzjYff%3DyG1g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAFKVRj-DTVnLjF1urA46D_ZKcZ3T9Q_x-KO-TSc8bjh%3DMKx%3DEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to