Project

General

Profile

Actions

Bug #13783

closed

Memory allocation / GC does not free unused memory

Added by opti (Andreas Opti) over 7 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
[ruby-core:82239]

Description

100.times {x=[]; 1000000.times {|i| x.push [i,i*3]} }
100.times should use (more or less) the same memory as 3.times,
also GC.start after x=[] doesn't help!
Problem: system begins swapping if doing that many times (using large data arrays running for longer times)

Updated by shyouhei (Shyouhei Urabe) over 7 years ago

  • Status changed from Open to Feedback

Hmm, I don't know exactly why so this might not fork for you but at least on my machine, the situation seems fixed in latest trunk. Can you test?

zsh % rbenv shell 2.4.1
zsh % ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]
zsh % for i in 1 4 16 64; do
          /usr/bin/time -l ruby -e $i.'times {x=[]; 1000000.times {|i| x.push [i,i*3]} }' |& fgrep resident
      done
  78553088  maximum resident set size
 195747840  maximum resident set size
 311996416  maximum resident set size
 341024768  maximum resident set size
zsh % rbenv shell trunk@svn
zsh % ruby -v
ruby 2.5.0dev (2017-08-04 trunk 59496) [x86_64-darwin15]
zsh % for i in 1 4 16 64; do
          /usr/bin/time -l ruby -e $i.'times {x=[]; 1000000.times {|i| x.push [i,i*3]} }' |& fgrep resident
      done
  73068544  maximum resident set size
 183775232  maximum resident set size
 183783424  maximum resident set size
 185192448  maximum resident set size

Updated by opti (Andreas Opti) over 7 years ago

I didn't manage to compile Ruby v250 (because of other errrors), nice to see that this bug is fixed now.
(I mentioned it in a mailinglist some months ago).
Now I found in the changelog "r59074 | ko1 | 2017-06-13 11:52:33 +0900 (Tue, 13 Jun 2017) | 5 lines"

  • not sure if it's that problem, maybe someone could backport that to 2.4.x ?

Seems also if updating 2.4.x -> 2.4.x+1 I have to reinstall [compile] all gems?

thanks
Opti

Actions #3

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0