Issue #13846 has been updated by kernigh (George Koehler).


I can reproduce this bug in 2.3 and 2.4 but not in trunk. I am using 2.3 and 2.4 from OpenBSD packages. I compiled trunk from source.

```
$ dmesg | head -2
OpenBSD 6.1 (GENERIC.MP) #19: Thu Aug  3 14:59:44 CEST 2017
    robert / syspatch-61-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
$ ruby -v
ruby 2.5.0dev (2017-09-06 trunk 59764) [x86_64-openbsd6.1]
$ ruby24 -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-openbsd]
$ ruby23 -v              
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-openbsd]
```

I run the loop in trunk ruby for some minutes, then watch the RES in top(1). It stays at 11M:

```
  PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
16837 kernigh   64    0   11M   11M onproc/0  -         6:50 94.73% ruby
```

When I run the loop in ruby23 or ruby24, I can see RES increasing slowly from 11M to 12M, 13M, and so on. The bug might be in Ruby 2.3 and 2.4, but not in Ruby trunk and not in OpenBSD's thread library.

----------------------------------------
Bug #13846: Openbsd possible memory leak when using Thread
https://bugs.ruby-lang.org/issues/13846#change-66519

* Author: parhs (Coding Gorilla)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.3.4
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
On openBSD 5.9/6.1 running this code causes RSS memory to increase without limit. This does not happen in ubuntu or other linux.

~~~ ruby
loop do
  thr = Thread.new { puts "thread test" }
  thr.join
  GC.start
end

~~~
This is related to other things too, like when calling Open3.* , virtually everything that is using threads...
I have attached a screenshot with RSS memory plot I did.

---Files--------------------------------
Screen Shot 2017-08-29 at 11.11.42 AM.png (51.7 KB)


-- 
https://bugs.ruby-lang.org/

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