When I run the following code in the profiler, I get a char[] and byte[] that build up until the program crashes due to a java heap out of memory exception. Can someone tell me
I would suggest you try two things:
Extend your timer to about 10 seconds. Two is expecting a lot for a slow system.
Put a Thread.currentThread.sleep(10)
(or similar) in your idle loop.
I expect you are not waiting for go
to complete. While you are spinning on air in your idle loop the database connecion is dying from lack of cycles and every two seconds you add yet another connection and query. No wonder the poor thing is struggling.