Copy-on-Write not working after fork when running GC in latest Ruby version

Hello everyone,

I have a huge problem with memory in Ruby 2.2.1. Namely, after forking a process, it seems that the copy-on-write functionality is not working at all and I end up with double the memory I started with. The problem is described in details under this link : https://bugs.ruby-lang.org/issues/10559#change-50245. Attached on the website is a program that demonstrates the issue. Since I need to work with huge pieces of data, this memory leakage is a killer issue :-/ Everything has been tested with latest version of Ruby on a clean installed Ubuntu 14.04 LTS machine.

Small update. I have played with the GC and have run several tests. I manage to solve the problem by disabling the GC with GC.disable, but then my memory gets filled with garbages. I have also disabled hugepages on linux and no effects. Finally I’ve played with some of the parameters of the GC like the heap size, and reducing its activity to 0 (GC.count) but no changes. Every test have been performed on the same machine with the same parameters.

Ruby -v 2.2.1