One more attempt to fix the memory leak

openid
Marcin Kulik 11 years ago
parent c9f2164dad
commit 0a8cc6ff8a

@ -1,6 +1,6 @@
GIT
remote: git://github.com/sickill/tsm.git
revision: db53f053195c0dc117689a626bb321381c3bfbe8
revision: 13841c34e7320807eda25086c430b8501d1c7bae
specs:
tsm (0.1.0)
ffi (~> 1.8)

@ -33,6 +33,11 @@ class Terminal
lines
end
def release
screen.release
vte.release
end
private
attr_reader :screen, :vte

@ -4,8 +4,10 @@ class SnapshotCreator
terminal = Terminal.new(width, height)
seconds = (duration / 2).to_i
bytes = stdout.bytes_until(seconds)
snapshot = terminal.feed(bytes)
terminal.release
terminal.feed(bytes)
snapshot
end
end

@ -6,7 +6,7 @@ describe SnapshotCreator do
describe '#create' do
let(:stdout) { double('stdout', :bytes_until => []) }
let(:terminal) { double('terminal', :feed => snapshot) }
let(:terminal) { double('terminal', :feed => snapshot, :release => nil) }
let(:snapshot) { double('snapshot') }
subject { snapshot_creator.create(80, 24, stdout, 31.4) }

Loading…
Cancel
Save