# Loading ActiveRecord and ActionMailer only in a worker process to save memory

**URL:** <https://www.ruby-forum.com/t/loading-activerecord-and-actionmailer-only-in-a-worker-process-to-save-memory/155477>\
**Category:** Rails\
**Created:** [December 12, 2008, 7:34am UTC](https://www.ruby-forum.com/t/loading-activerecord-and-actionmailer-only-in-a-worker-process-to-save-memory/155477 "2008-12-12T07:34:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcarneiro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e36b37/32.png) [@dcarneiro](https://www.ruby-forum.com/u/dcarneiro)\
**Post date:** [December 12, 2008, 7:34am UTC](https://www.ruby-forum.com/t/loading-activerecord-and-actionmailer-only-in-a-worker-process-to-save-memory/155477/1 "2008-12-12T07:34:12Z")

</div>

For a Rails app, I have a SimpleDaemon process that does some URL  
fetching and sends off emails. The daemon script requires the config/  
environment.rb of the Rails app. But this script really only needs to  
require ActiveRecord and ActionMailer. I’m thinking of refactoring my  
code so as not to include the entire Rails environment, but I have a  
two questions for anyone who has experience doing something similar:

1. Can it save a lot of memory to do this?

2. If I’m using Ruby Enterprise Edition and Phusion for the Rails app,  
do the memory and speed benefits extend to the daemon script?

Thanks to anyone who can help
