You don't seem to have any code in your readInstrument() function to prevent a buffer overflow. I have not looked for an equivalent problem elsewhere.
If this was my project I would define all the big arrays as globals so I would have more control over my use of memory.
...R