database - Java deque / prepared statement memory leak -


One of the following pieces of code generates memory leak, any part of any idea?

1)

  Private Decks & Lt; Snapshot & gt; Snapshots = new linked list & lt; Snapshot & gt; (); Iterator & LT; Snapshot & gt; I = world.getSnapshots () Descending (); While (i.hasNext ()) {snapshot S = i.next (); If (Curium - STTSTstamp (>> 60000) {i.remove (); } And {break} }}  

2)

  public static zero-intrited state () {tryNewReportRow = Instance.getWorld (). GetDB () GetConnection (Deployment) from "RCA2_Reports" (`` ``, `About`,` Time`, `Reason ',' Snapshot_prom`, 'Snapshot_About`,` Chatlags`, `to_x`,` From_A `,` Approx _x`, `about_a value (?,?,?,?,?,?,?,?,?,?,?,?)));} Hold (SQLException e) {e.printstackscres () ; Logger.error (E);}} Public synchronize static void submitReport () {/ * removed / try {insertNewReportRow.setLong (from, 1); InsertNewReportRow.setLong (about 2); InsertNewReportRow.setLong ( 3, time); InsertNewReportRow.setInt (4, Reason); InsertNewReportRow.setString (5, snapshot_from); InsertNewReportRow.setString (6, S) Napshot_outout); InsertNewReportRow.setString (7, chatlag); InsertNewReportRow.setInt (8, f.getX); InsertNewReportRow.setInt (9, f.getY); InsertNewReportRow.setInt (10, a.getX ()) ; InsertNewReportRow.setInt (11, a.getY); insertNewReportRow.executeUpdate ();} Grip (SQLException e) {E.PintstacksTrace (); Logger.error (E);}}  

My guess is that it is instance.getWorld (). GetDB () .getConnection () Where you get a connection and only store the reference to the statement made it means that when your code is done with a prepared statement and (it considers That it comes from a connection pool) connection connection does not recycle the connection, but it will keep it in the context of its map.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -