I think there is a memory issue here, I am using this code on my function and discovered that buffer is not cleared. I solved it by creating a new buffer like so:
var new_buffer = new Buffer(this.rowBytes*rows)
buffer.copy(new_buffer)

Hopefully it will not create a memory leak.