• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

web application memeory leak

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting a memory leak with a web application I am developing and would appreciate help in tracking down the cause.
General Application Structure:
* The application follows a standard Model-View-Controller (MVC) Pattern. All requests are handled by a Controller servlet which queries the database (via a helper class which is instantiated in the Controllers Init() method) and then passes to JSP view.
* The helper class opens a connection pool to a Lotus Notes database (type II driver), executes the query and passs back the results in a Arraylist and a Hashmap.
Test Environment:
Tomcat 4.0.3 on Windows 2000, JDK is 1.3.1
When stress testing the application the memory usage goes up after each test and the memory resources do not get released, until eventually it crashes the tomcat server.
Here's the helper class method that is used by the servlet to get an Arraylist of products to display. myConn is the Connection Pool
public ArrayList getStockItems(String[] ref)
throws SQLException, ClassNotFoundException {
tempConn = myConn.getConnection();
ArrayList products = new ArrayList();
try {
products.clear();
for (int i = 0; i < ref.length; i++) {
stmt = tempConn.createStatement();
rs = stmt.executeQuery("SELECT * FROM IsStockView
WHERE prodCode ='"+ref[i]+"'");

while (rs.next()) {
prodCode = rs.getString("prodCode");
prodName = rs.getString("prodName");
// various other details retrieved...
tempStockItem = new StockItem(prodCode, prodName,...);
products.add(tempStockItem);
}
rs.close();
}//end of for loop..
}
catch (Exception e) {
e.printStackTrace();
}
finally {
if (tempConn != null) {
myConn.releaseConnection(tempConn);
}
}
return products;
}
I have run this also with JProbe memory debugger, but finding it difficult to interpret the results - there doesn't seem to be any obvious loitering objects. I am wondering if the leak could be with the JDBC driver. How can I confirm if the driver is the problem, given it is Type II and uses the Notes C++ API?
All views and opinions will be appreciated.
--
Thanks
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you investigated the driver on a lotus site or knowledgebase?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many of the "memory leak" problems I have heard of were found to be due to failure to properly close or otherwise release Statement objects or related JDBC resources - it looks like you create a Statement but don't close it.
Bill
 
What a stench! Central nervous system shutting down. Save yourself tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic