Java - Out Of Memory Error: Java Heap Space - PreparedStatement

Out Of Memory Error: Java Heap Space - PreparedStatement

程式跑了約20~50筆SQL後,發生了Out Of Memory Error: Java Heap Space

程式死在下面這段敘述 

conn.prepareStatement(sql);

發現,只要我close 了PrepareStatement,不只效能也變好了,也可以解決Out Of Memory Errror的問題。

參考網址:

https://stackoverflow.com/questions/32511190/out-of-memory-error-java-heap-space-preparedstatement-mysql