From: Eric Wong Date: 2011-10-13T05:21:50+09:00 Subject: [ruby-core:40125] Re: [Ruby 1.9 - Bug #5437][Open] Using fibers leads to huge memory leak Robert Pankowecki wrote: > ruby -v: ruby 1.9.3dev (2011-10-11 revision 33457) [x86_64-linux] > fibers = [] > > GC.start GC.start is never guaranteed to release memory (especially not with lazy sweep). Even if GC.start always releases memory (via free(3), malloc(3)/free(3) implementations are not guaranteed to release memory back to the kernel. > We can see on our production instance that the more Fibers are in use > the more memory is never reclaimed back to OS and the bigger the leak > is. Since you're on Linux, I assume you're using glibc/eglibc and hitting this problem with its malloc. The comment starting with "Update in 2006" in malloc/malloc.c (git://sourceware.org/git/glibc.git) can give you an explanation of why memory isn't always given back to the kernel. To workaround this glibc malloc issue, you can try setting MALLOC_MMAP_THRESHOLD_=131072 (or another suitable value) in the env and possibly trade performance for less memory use.