Project

General

Profile

Actions

Backport #10559

closed

Unexpected copy on write when running GC in 2.1.3

Added by niels_tolstrup (Niels Tolstrup) almost 10 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
[ruby-core:66619]

Description

Memory is duplicated when forking and calling GC in 2.1.3.

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.1.3
   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 2.1.3 and 2.1.5.

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.


Files

mem.rb (1.25 KB) mem.rb niels_tolstrup (Niels Tolstrup), 12/01/2014 02:28 PM

Updated by usa (Usaku NAKAMURA) almost 10 years ago

  • Project changed from Backport193 to Backport21
Actions #2

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0