H
Han Holl
Hello,
I must be doing something quite wrong, but I'm stumped by this:
The server:
require 'drb'
class Server
def pgproxy
return DatabaseProxy.new
end
end
class DatabaseProxy
include DRbUndumped
def exec(q, *methods)
a = Array.new(10000)
STDERR.puts "Created #{a.object_id}"; STDERR.flush
ObjectSpace::define_finalizer(a, proc {|id| STDERR.puts
"Finalizer #{id}"; STDERR.flush } )
a
end
def gc
GC.start
end
end
DRb.start_service("drbunix:/tmp/testdrb", Server.new)
DRb.thread.join
### end of server.rb
And the client:
require 'drb'
DRb.start_service
b = DRbObject.new(nil, "drbunix://tmp/testdrb").pgproxy
100.times do
a = b.exec('aa')
end
b.gc
### end of client.rb
If I run them I don't see any garbage collection going on in the
server process, and the process size grows considerably.
Who is holding references to these arrays ?
Thanks in advance for any light shed on this.
Cheers,
Han Holl
I must be doing something quite wrong, but I'm stumped by this:
The server:
require 'drb'
class Server
def pgproxy
return DatabaseProxy.new
end
end
class DatabaseProxy
include DRbUndumped
def exec(q, *methods)
a = Array.new(10000)
STDERR.puts "Created #{a.object_id}"; STDERR.flush
ObjectSpace::define_finalizer(a, proc {|id| STDERR.puts
"Finalizer #{id}"; STDERR.flush } )
a
end
def gc
GC.start
end
end
DRb.start_service("drbunix:/tmp/testdrb", Server.new)
DRb.thread.join
### end of server.rb
And the client:
require 'drb'
DRb.start_service
b = DRbObject.new(nil, "drbunix://tmp/testdrb").pgproxy
100.times do
a = b.exec('aa')
end
b.gc
### end of client.rb
If I run them I don't see any garbage collection going on in the
server process, and the process size grows considerably.
Who is holding references to these arrays ?
Thanks in advance for any light shed on this.
Cheers,
Han Holl