-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
It seems that Lua::Function and Lua::Table are never getting removed from memory. Lua::State is only removed when manually removing all references.
require 'rlua'
def stressloop_for(c, *klasses)
GC.start
GC.stress = true
c.times do
yield
end
GC.stress = false
GC.start
klasses.each do |klass|
puts "Instances of #{klass}: #{ObjectSpace.each_object(klass).count}"
end
end
stressloop_for(10, Queue) do
q = Queue.new
q << 'hi'
end
# => Instances of Queue: 0
stressloop_for(10, Lua::State, Lua::Function, Lua::Multret, Lua::Table) do
s = Lua::State.new
s.add = ->(a, b) { a+b }
s.__eval('return(add(1,1))')
end
# => Instances of Lua::State: 10
# => Instances of Lua::Function: 10
# => Instances of Lua::Multret: 0
# => Instances of Lua::Table: 10
stressloop_for(10, Lua::State, Lua::Function, Lua::Multret, Lua::Table) do
s = Lua::State.new
s.add = ->(a, b) { a+b }
s.__eval('return(add(1,1))')
s = nil
end
# => Instances of Lua::State: 10
# => Instances of Lua::Function: 20
# => Instances of Lua::Multret: 0
# => Instances of Lua::Table: 20Metadata
Metadata
Assignees
Labels
No labels