On 2016/03/07 3:37, vmakarov / redhat.com wrote:
> I don't think it is a leak.  What you measure is the maximal residential size.  I think the table is rebuilt many times and memory for previous version of tables is freed but it is not freed to OS by MRI (or glibc.  I don't know yet what allocation library is used by MRI).  Still this is *very* bad.  I should definitely to investigate and fix it.  I believe I know how to fix it.  I should reuse the array elements when it is possible.  Thanks for pointing this out.

trunk (without your patch):

$ for i in 1 10 100 1000 10000 100000 1000000 10000000
> do /usr/bin/time -f%Mkb ./miniruby -e "h=Hash.new; $i.times{|i|h[i] =
i; h.delete(i-1)}"
> done
3504kb
3504kb
3512kb
3508kb
3504kb
3516kb
3516kb
3516kb

This is what I asked in my comment.

>   * (rare case) so many deletion can keep spaces (does it collected? i need to read code more)
> 
...
> 
> We can generalize the last issue as "compaction".
> This is what I didn't touch this issue yet (maybe not a big problem).

And you didn't response about that :)

-- 
// SASADA Koichi at atdot dot net


Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>