Fix issue #18

Fix memory leak caused by setting `instruments = []` rather than `instruments.length = 0`.