Ruby - free up memory used by required gems?
Is there a way to free up memory used by required gems? My Rails app grows in memory usage and I would like to use gems only when I need them and after that free them up, IF this is po开发者_如何学JAVAssible.
Thanks!
The whole purpose of a memory managed programming language (Ruby) is to avoid developers having to concern themselves with such issues. If memory does become a sticking point, you'll need to profile the memory by using the following tools
ruby/ruby on rails memory leak detection
Although your control over memory is limited to ensuring memory leaks are avoided and the overall architecture is inline with best practices. An example is ImageMagick takes excessive memory, so rather than having images being converted by all rails mongrels/passengers, restricting the conversion to dedicated ruby services, so as to avoid a large memory footprint.
The Garbage Collector do it this best to you. There are no better solution. Check all part where you can have some memory leak and avoid it. Use less of gems too.
精彩评论