Project

General

Profile

Actions

Bug #20149

closed

Fix memory leak in IPSocket rb_getaddrinfo

Added by HParker (Adam Hess) 11 months ago. Updated 10 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:116015]

Description

PR: https://github.com/ruby/ruby/pull/9413

Fixes a memory leak pthread_attr is created, but never cleaned up

require 'socket'

10.times do
  10_000.times do
    IPSocket.getaddress("localhost")
  end

  puts `ps -o rss= -p #{$$}`
end

before:

26744
33400
39928
46328
53240
59640
66168
72696
79352
85880

after:

20864
20864
20864
20864
20864
20992
20992
20992
20992
21120

This likely needs a backport to Ruby 3.3 series.

Actions

Also available in: Atom PDF

Like1
Like1Like0Like0