Very simple Ruby GServer memory leak

I have the following Ruby script:

class Server <GServer

  def initialize    
    super (10001)
  end


  def serve (io)
    while true
     io.puts `ps -o rss = -p # {$$}` .to_i
    end
  end

end

server = Server.new
server.start

while true
  sleep 10
end

When I open a connection to the server, it shows an increase in memory usage over time, without any new connections or anything to do.

Am I doing something wrong or is there a memory leak problem in GServer?

BTW: I tested it on MacOSX with Ruby 1.8.7 and on Debian with 1.9.2.

+3
source share
1 answer

16kb . , . , mem-prof valgrind.

+3

Source: https://habr.com/ru/post/1766860/


All Articles