I've been playing around with the ruby bindings for a while and I've found
some memory leaking issues. I'm using subversion 1.3.1 (not trunk) and I'm
hoping somebody can add some insight into why this code causes a memory
leak:
#!/usr/bin/ruby
require 'svn/repos'
require 'svn/client'
repo = Svn::Repos.open('/usr/local/subversion/bs')
(1..10000).each {
repo.fs.root.node_history('/')
GC.start
puts "pools left: " +
(ObjectSpace.each_object(Svn::Ext::Core::Apr_pool_wrapper_t)
{}).to_s
}
When I run this code, I get:
pools left: 7
pools left: 8
pools left: 9
pools left: 10
pools left: 11
pools left: 12
pools left: 13
pools left: 14
pools left: 15
pools left: 16
pools left: 17
pools left: 18
pools left: 19
pools left: 20
pools left: 21
pools left: 22
pools left: 23
.....
If I move the "repo = Svn::Repos.open('/usr/local/subversion/bs')" line
inside the loop (so it destroys the repo object and re-creates it every
iteration), then it doesn't leak and stays at a constant:
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
pools left: 7
Can anybody provide some insight?
-Warren
Received on Tue May 2 02:42:44 2006