Here is the problem : the memory is duplicated when forking and calling GC 
in 2.2.1. The main issue here is that I am operating on huge data, going up 
to 1GB, and when the GC is running and I am forking a process, it is 
killing my machine since the 1GB becomes 2GB.

We have written a small program that reproduces the issue (see attached 
file).

   1. The program instantiates an object and then forks into two processes.
   2. The GC is called in the child process.
   3. The memory allocation (as given by /proc/*pid*/smaps) changes from 
   shared to private, thereby indicating a doubling of memory consumption.

Here is the output of the program (size is in mb):

ruby version 2.2.1
   time   pid message             shared    private
 4.011s  4723 Parent pre GC           68          0
 4.013s  4737 Child  pre GC           68          0
 8.019s  4723 Parent post GC           5         62
 8.093s  4737 Child  post GC           5         66


We have tested the program on Ubuntu 14.04 with ruby 1.9.3 and 2.2.1. The 
tests have been performed on a freshly installed Ubuntu machine with no 
other software.

We have also tried to fork 10 children and see a 10 doubling of the memory 
consumption, the issue only occurs after running the GC.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Attachment: mem.rb
Description: Binary data

Reply via email to