Sha256: 0da93782ac3595eeddf5d3782cab989f313000e5818db3e6198d300998a39e79

Contents?: true

Size: 989 Bytes

Versions: 4

Compression:

Stored size: 989 Bytes

Contents

##
#
  require 'dao'
  require 'rubygems'
  gem 'activesupport', '>= 3.0.7'
  require 'active_support'
  require 'active_support/dependencies'

##
#
  leak =
    lambda do
      Api =
        Dao.api do
          1000.times do |i|
            call("/foobar-#{ i }") do
            end
          end
        end

      api = Api.new

      result = api.call('/foobar-1')
      p result

      ActiveSupport::Dependencies.unloadable(Api)
      ActiveSupport::Dependencies.remove_unloadable_constants!
    end

##
#
  n = 10

  leak.call()

  GC.start
  leak.call()
  GC.start

  p :before => Process.size


  GC.start
  leak.call()
  GC.start

  p :after => Process.size













##
#
  BEGIN {

    module Process
      def self.size pid = Process.pid 
        stdout = `ps wwwux -p #{ pid }`.split(%r/\n/)
        vsize, rsize = stdout.last.split(%r/\s+/)[4,2]
      end

      def self.vsize
        size.first
      end

      def self.rsize
        size.last
      end
    end

  }

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dao-3.3.0 a.rb
dao-3.2.0 a.rb
dao-3.1.2 a.rb
dao-3.1.1 a.rb