-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak on basic operations #8
Comments
Can you confirm that with the latest release are we all good? |
I'm still seeing a leak. Is there a pointer that isn't being free'd? |
This GC test is incorrect. The Also keep in mind that GC.start will not execute a full mark and sweep unless you run If you use #!/usr/bin/env ruby
require 'leveldb'
require 'objspace'
db = LevelDB::DB.new("/tmp/leaktest")
GC.start(full_mark: true, immediate_sweep: true)
puts ObjectSpace.count_objects
# {
# :TOTAL=>92121,
# :FREE=>44550,
# :T_OBJECT=>4539,
# :T_CLASS=>1549,
# :T_MODULE=>88,
# :T_FLOAT=>6,
# :T_STRING=>25147,
# :T_REGEXP=>342,
# :T_ARRAY=>8794,
# :T_HASH=>387,
# :T_STRUCT=>34,
# :T_BIGNUM=>2,
# :T_FILE=>3,
# :T_DATA=>4074,
# :T_MATCH=>1,
# :T_COMPLEX=>1,
# :T_RATIONAL=>1,
# :T_NODE=>2469,
# :T_ICLASS=>134
# }
100000.times do
db.get('foo')
end
GC.start(full_mark: true, immediate_sweep: true)
puts ObjectSpace.count_objects
# {
# :TOTAL=>92121,
# :FREE=>44528,
# :T_OBJECT=>4539,
# :T_CLASS=>1549,
# :T_MODULE=>88,
# :T_FLOAT=>6,
# :T_STRING=>25171,
# :T_REGEXP=>341,
# :T_ARRAY=>8793,
# :T_HASH=>389,
# :T_STRUCT=>34,
# :T_BIGNUM=>2,
# :T_FILE=>3,
# :T_DATA=>4074,
# :T_MATCH=>1,
# :T_COMPLEX=>1,
# :T_RATIONAL=>1,
# :T_NODE=>2467,
# :T_ICLASS=>134
# } |
Sample output:
Just for db.get on a nonexistant key 10,000 times, looks like there were 160024 allocated objects that can not get freed
The text was updated successfully, but these errors were encountered: