Memory Leaks in Java

Hi,
I have a considerably large business application that consists of JSPs and JavaBeans which connects to a database. The application runs off a Tomcat server. Some information about the application is as follows:
a. JDK version 1.4.2_11
b. Database used is MS SQL Server 2000 with Server pack 4
c. Running on Tomcat version 4.1.31. Tomcat is being run under services.
d. Third party libraries -
     Cryptix32
     i-Net Crystal Clear
     CeWolf and JFreeChart
     iText
     jxl
I noticed that the Tomcat memory utilization increases after a period of using the application.
I recently purchased JProbe as it was recommended as a good tool to check for memory leaks in Java applications. Having purchased Jprobe, the team is now proceeding to investigate the cause of the problem.
I would like very much to seek the expertise of the community here as to some technique / steps the team should take during the course of the investigation.
We are currently following the following steps:
a. Startup JProbe
b. Set a JProbe J2EE memory session which points to Tomcat and JDK
c. Run the JProbe session
d. Do a Collect Stack Trace
e. Login to our application, execute a "single function" and then logout
f. Do an Include Heapdump in Snapshot
g. Save the snapshot
h. Stop the JProbe session
i. Investigate the output
j. Repeat (c) to (i) for other functions in our application
Would appreciate if the community here could advice if we are proceeding with the investigation correctly and whether we are missing out on any memory leaks. All suggestions are most welcome.
Thanks.

Hi,
Just a bit more information about the application:
Application contains:
- 4490 JSP files
- 1492 Java Classes
Application Server:
- Tomcat 4.1.31
- JDK 1.4.2_11
Database:
- Microsoft SQL Server JDBC 2000
- Microsoft SQL Server 2000 SP4
Other JAR files:
- Cryptix 32
- jxl
- CeWolf
- i-Net Crystal Clear
All items mentioned above is running on a Server with Microsoft Windows Server 2003 with 2GB of RAM.
The JSP communicates to the JavaBean which in turn will connect to the Database via JDBC. We are not using connection pooling at the moment.
The SQL Server takes around 1GB of ram and I have configured Tomcat with an Initial 250MB and a maximum of 750MB of RAM. Tomcat is running under NT services.
Tomcat memory slowly increases and it takes around 4-7 weeks before it reaches the maximum memory and we get the out of memory error.
We have done checking for memory leaks using JProbe but have not found any leaks in our program yet. We did find some of our classes were not closing the connection. I am not sure whether this could be the cause of the memory leak. We have also checked for static members in our classes and have not found anything wrong with them.
Can anyone tell me whether:
a) Is 2GB RAM sufficient for this type of configuration?
b) If we add more RAM will it be more beneficial?
c) Our Tomcat web.xml configuration. Reloadable = true, Development = true. Will this cause memory leaks?
d) Should we upgrade to Tomcat 5 or 6?
e) Should we upgrade the JDBC Driver to 2005?
f) Should we upgrade the version of JDK to 1.5 or 1.6?
g) Is it recommended to restart Tomcat every now and then?
Thanks.

Similar Messages

  • Memory Leak in  Java

    Anyone can suggest what is the best way to test memory leak in JAVA?
    Thanks in advance for the help.

    I'll try to define it for the OP
    Define: memory leakhttp://en.wikipedia.org/wiki/Memory_leak
    Define: bestDoesn't really apply but wondered what wikipedia would return: http://en.wikipedia.org/wiki/Best
    Define: testhttp://en.wikipedia.org/wiki/Software_testing

  • Possible causes for memory leak in Java and Tomcat

    I would like to enquire what are the typical mistakes done by programmers that will cause memory leak in Java and Tomcat.

    Please refer the below site. It will give more points about the memory leak and how to rectify it.
    http://www.experts-exchange.com/Software/Server_Software/Application_Servers/Q_20981562.html?cid=336

  • About Memory Leak in JAVA Any body pls help me

    Hi All,
    In our application, with JAVA we are using c, c++ native methods also.
    The problem is, Eventhough the application is in idle state, the Virtual Memory occupation is getting increased. For 24 hours, 30 MB is increased, while the application is in idle state.
    Is there any possiblity, this much memory leak can happen in JAVA. or it is from Native c side..
    I would appreciate anybody' s help.

    Thanks
    I am using JProfiler for that. I can observe what kind of objects not getting freed and the size of memory it is taking. and i observed thro JProfiler, that is only 16 kb of memory leak is happening. Can Any body who is well known about JProfiler help me. Can i differentiate the memory leak from JAVA and Native C side using JProfiler.
    Any help would be appreciated.

  • Memory Leak in Java Server

    Howdy Folks- I wrote a server monitor in java, which I was expecting to run for months at a time without restarting. Apparently there is some slow memory leak which results in an OutOfMemoryError after a few weeks. It's in a production system, so I can't readily add debug statements to the code, and the OutOfMemoryError apparently screwed up the logging, so I didn't get a stack trace in my logs, just an "OutOfMemoryError" went to standard out.
    I'm assuming the problem lies in the code, specifically probably some discarded reference that is not being properly garbage collected? I am using a few different ArrayLists to store some historical information, and I call clear() on these frequently. Is there any known issue with ArrayList or HashMap that the "clear()" method doesn't result in garbage collection of the objects that were in it? I am also doing a "remove(int)" sometimes as well. Any chance the objects cleared or removed would not be garbage collected?
    thanks
    Bleu

    Howdy Folks- I wrote a server monitor in java, which I
    was expecting to run for months at a time without
    restarting. Apparently there is some slow memory leak
    which results in an OutOfMemoryError after a few
    weeks. It's in a production system, so I can't
    readily add debug statements to the code, and the
    OutOfMemoryError apparently screwed up the logging, so
    I didn't get a stack trace in my logs, just an
    "OutOfMemoryError" went to standard out.Are you even attempting to catch Errors? Catching Exceptions will not help with this. It should print the stack trace. When it OOMs it doesn't mess up what's already allocated, it just can't allocate more.
    I'm assuming the problem lies in the code,
    specifically probably some discarded reference that is
    not being properly garbage collected? Most likely, there are references that are never being cleared in your code. Without seeing the code or at least having a better description, I don't think anyone here can help you. Can you set up a test senario and use an Optimizer to see what's going on?
    I am using a
    few different ArrayLists to store some historical
    information, and I call clear() on these frequently.
    Is there any known issue with ArrayList or HashMap
    that the "clear()" method doesn't result in garbage
    collection of the objects that were in it? Not that I know of, no. I doubt that is the problem.

  • How to root out memory leak with  Java JNI & Native BDB 11g ?

    We are testing a web application using the 32-bit compiled native 11g version of BDB (with replication) under 32-bit IBM 1.5 JVM via JNI under 64-bit RedHat Linux. We are experiencing what appears to be a memory leak without a commensurate increase in Java heap size. Basically the process size continues to grow until the max 32-process size is reached (4Gb) and eventually stops running (no core). Java heap is set to 2Gb min/max. GCs are nominal, so the leak appears to be native and outside Java bytecode.
    We need to determine whether there is a memory leak in BDB, or the IBM JVM or simply a mis-use of BDB in the Java code. What tools/instrumentation/db statistic should be used to help get to root cause? Do you recommend using System Tap (with some particular text command script)? What DB stats should we capture to get to the bottom of this memory leak? What troubleshooting steps can you recommend?
    Thanks ahead of time.
    JE.
    Edited by: 787930 on Aug 12, 2010 5:42 PM

    That's troublesome... DB itself doesn't have stats that track VM in any useful way. I am not familiar with SystemTap but a quick look at it seems to imply that it's better for kernel monitoring than user space. It's pretty hard to get DB to leak significant amounts of memory. The reason is that it mostly uses shared memory carved from the environment. Also if you are neglecting to close or delete some object DB generally complains about it somewhere.
    I don't see how pmap would help if it's a heap leak but maybe I'm missing something.
    One way to rule DB out is to replace its internal memory allocation functions with your own that are instrumented to track how much VM has been allocated (and freed). This is very easy to do using the interfaces:
    db_env_set_func_malloc()
    db_env_set_func_free()
    These are global to your process and your functions will be used where DB would otherwise call malloc() and free(). How you get usage information out of the system is an exercise left to the reader :-) If it turns out DB is the culprit then there is more thinking to do to isolate the problem.
    Other ideas that can provide information if not actual smoking guns:
    -- accelerate reproduction of the problem by allocating nearly all of the VM to the JVM and the DB cache (or otherwise limit the allowable VM in your process)
    -- change the VM allocated to the JVM in various ways
    Regards,
    George

  • What is memory leak in Java context?

    I am looking for a precise definition here...

    If you are looking for HOW a memory leak can show up in java, here are a few examples:
    A stack implemented on an array can have a memory leak if the object's position in the array isn't set to null after the object is popped off the stack (I think I first saw that in "effective java", by joshua bloch, if you want to look more into that).
    Another way: interning strings to the jvm can cause a memory leak, because once a string is interned, it is stuck there forever, even if all other references to the string are gone, and the string will never again be used.
    Furthermore, any flyweight concept that doesn't have a strategy for pruning away unused object (objects with 0 external remaining references) will be a memory leak of a sort.
    Hash maps are another place you can run into this problem. They may hold the only reference to both objects of a pair, and hence, since the key exists nowhere else, the pair is basically useless, but the map does prevent them from being garbage collected.
    What's the common link? The all have to do with some data structure or another maintaining obsolete references to objects. Since objects can't go out of scope if they are stored in a data structure that doesn't go out of scope, they cannot be garbage collected.
    - Adam

  • Huge memory leak in java jvm after update 2 for Snow leopard

    Since I updated to Java Update 2 for Snow Leopard my JVM suddenly grows massive (10GB+ real memory - -Xmx=3500m) consuming all memory and rendering my iMac unusable. This does not happen predictably but does happen several times a day now requiring I power off and on again.
    I had been living happily with update 1 with no such problem.
    I need to either go back to update 1 (should have it on Time Machine) or find a solution for this problem.

    Our application is a j2ee-based commercial application facing to specified customers, having about 120 access request an hour.
    We ' re doing stress test on the test server. The strange memory leak occurs at 1:20 am this morning while we're out of company , and no job was scheduled to run at that time. So I have the tendency to image that there is something inside oc4j had occured.
    I have used OptimizeIt to monitor the heap status. However , as the memory leak problem occurs very occasionally ,and that tool deadly slows our server, we are currently using no profiling tools.

  • 5.0.2 still MEMORY LEAKS with Java on multiple tabs/windows

    same problem with last update.
    Memory Leaks (upto 2.5 GB) when Java applets load
    in multiple windows/tab.
    Someone also have this problem?
    My other post prior of last update:
    http://discussions.apple.com/message.jspa?messageID=12204453#12204453
    Message was edited by: fascox

    If you want to report this issue to Apple's engineering, send a bug report or an enhancement request via its Bug Reporter system. To do this, join the Mac Developer Program—it's free and available for all Mac users and gets you a look at some development software. Since you already have an Apple username/ID, use that. Once a member, go to Apple BugReporter and file your bug report or enhancement request. The nice thing with this procedure is that you get a response and a follow-up number; thus, starting a dialog with engineering.

  • COREDUMP,MEMORY LEAK in java

    HI
    I am frequently hearing these words "CORE DUMP,MEMORY LEAK...."
    Can anybody explain me wat is this?
    Thnx in Advance!

    Check this link for excellent explanation
    http://www.me.umn.edu/~shivane/blogs/cafefeed/2004/06/of-thread-dumps-and-stack-traces.html

  • Finding memory leaks in java

    Hello,
    I have a memory leak in my application. I have found other memory leaks in the software using JProfiler, but I have a problem with JProfiler finding this one. My biggest problem is the JProfiler itself. If I use short runs, the JProfiler works fine. If I run my application for more than half a day, the JProfiler eats up memory and after a while it stops responding.
    I tried JProbe, but after profiling my application for 18 hours straight, it got buggy and wouldn't work correctly. It also ate up alot of memory, and couldn't process my snapshot after 18 hours of run. I saved all snapshots, and restarted JProbe. The initial snapshot was read correctly, but the final snapshot threw an NegativeArraySizeException.
    So, now I am looking for other tools which are able to find memory leaks without hanging or crashing after running 24 hours. Any recommendations?

    I dont know any other profiler you can use, but how about using the divide and conquer approach?
    Disable a significant section of your application and let it run for a day. If the leak occurs, its in the non disabled part.
    If it doesn't, its in the disabled part. Next, enable all the code. Then disable about half of the half that failed and try that. Continue doing so until
    you isolate the code enough that you can look at it and hopefully find the problem. Note you will need to keep track of what you previously enabled and disabled as a test (I put comments in the code).
    Alternately, you can look at functions that perform complex functionality that you suspect might be the problem and have the function return
    dummy data rather than perform the functionality. If the leak goes away, its that function(s).
    Example:
    public String getComplexData(String arg1, String arg2){
    //this section bypasses the complex code and returns dummy data
    boolean x1= true;
    if(x1==true)
    return new String("some dummy data");
    //complex functionality goes here.
    Also of help would be to list everything that can cause a memory leak (I assume its a memory leak and not a resource leak such as not closing connections).
    Here are some ideas:
    1) persistant class variables that are a collection that have objects added to them but never deleted and allowed to be garbage collected
    such as static class variables, session scope variables, or application scope variables.
    2) An object tree where one of its nodes is never set to null to be garbage collected (such as a static class variable).
    If you are running a web application in a clustered enviornment, try running it on only one server.

  • Memory leak in java / forcing garbage collection for unused resource?

    Is there any possibility in big programs if not designed properly for leakage of memory?
    If say i forget to force garbage collection of unused resouces what will happen?
    Even if i am forcing garbage collection how much assurity can be given to do so?
    I need answers w.r.t typical programming examples if someone can provide i will be happy.
    Or any useful link.
    Thanks
    Vijendra

    Memory leaks are usually much related with C/C++ programming since in that language you have direct access to memory using pointers.
    Now, in Java you do not have access to pointers, however you could still tie up your objects in a way that the garbage collection can not remove them.
    Basically, the grabage collection will search all the object implementation, and see if they are referenced or not. If not it will free that memory. However if you, somehow in you code allow a reference to your object then the garbage collection will not displose of that object.
    An example I can think of is when developing web applications. For example storing objects in the session will mean that you will have a reference to the object from the session, therefore the garbage collection will not free up the meomry taken by those objects untill the session has expired.
    That is how I know it... at least that is how they tought it to me!
    regards,
    sim085

  • Memory leak in java stored procedure

    I use one simple example to test java stored procedure but i have met one serious problem. If it's not my fault, there exists serious bug of Oracle JVM. And the problem make it more like a toy.
    (1) java program Test.java
    public class Test {
    public static void tst() {
    (2) javac Test.java
    (3) loadjava -user scott/tiger -oci8 -resolve -verbose Test.class
    (4) create or replace procedure tst
    AS LANGUAGE JAVA
    NAME 'Test.tst()';
    (5) test.sql
    Begin
    for loop_v in 1..100000000 loop
    tst();
    end loop;
    end;
    (7) execute the test.sql
    sqlplus scott/tiger
    @test (6) oracle version information:
    oracle 8.1.7, Linux 2.4.2
    (7) problem:
    When the test.sql is executed , I use top tool to monitor the oracle process. I found the column SIZE value is gradually climbed. When reaching some point test.sql lose connection with oracle server. It always use out all the memory of Linux system.
    If the test is correct, I think oracle java stored procedure is just like one toy.
    zhu zhong hua

    I'll try to define it for the OP
    Define: memory leakhttp://en.wikipedia.org/wiki/Memory_leak
    Define: bestDoesn't really apply but wondered what wikipedia would return: http://en.wikipedia.org/wiki/Best
    Define: testhttp://en.wikipedia.org/wiki/Software_testing

  • Com.mysql.jdbc.JDBC4Connection suspected memory leak in java

    We have a java application where we are using Bonecp pooling library. Below is how we setup the pooling.
    [code]
    try {
       // setup the connection pool
       BoneCPConfig config = new BoneCPConfig();
      config.setJdbcUrl("jdbc:mysql://**.**.**.**:3306/test1");  config.setUsername("******");
      config.setPassword("*******");  config.setMinConnectionsPerPartition(5);
      config.setMaxConnectionsPerPartition(40);
      config.setPartitionCount(1);
      connectionPool = new BoneCP(config); // setup the connection pool 
       catch (SQLException e) {
      e.printStackTrace(System.out);
    [/code]
    Then for insert and update queries we do this and below we make sure closed the statement.
    [code]
    Statement stmt1 = null;
    stmt1 = dbconn.createStatement();
    String insertQuery3 =........
    count = stmt9.executeUpdate(insertQuery3);
    try{
       if ( stmt1!= null ){  stmt1.close();
       else{
       System.out.println("No stm1 exist");
    }catch(SQLException ex){   System.out.println("SQLException has been caught for stmt1");
    ex.printStackTrace(System.out);
    For select we do this 
    Statement stmt2 = null;
    stmt2 = dbconn.createStatement();
    String selectQuery2= .........
    ResultSet rs2 = stmt2.executeQuery(selectQuery2);
    if(rs2.next())
    try{
       if ( rs2!= null ){  rs2.close();
       }   else{
       System.out.println("No rs2 exist");
       if ( stmt2!= null ){  stmt2.close();
       }   else{
       System.out.println("No stm2 exist");
    }catch(SQLException ex){   System.out.println("SQLException has been caught for stmt2");
    ex.printStackTrace(System.out);
    [/code]
    Thus we have ensured that every resultset and statement is closed immediately after its use. The problem now when we took few sample from MAT is show increasing memory usage as below.
    Sample 1
    [code]
    21 instances of "com.mysql.jdbc.JDBC4Connection", loaded by "sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0" occupy 11,793,200 (76.19%) bytes.
    Biggest instances:
    com.mysql.jdbc.JDBC4Connection @ 0xf016d728 - 958,096 (6.19%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0094478 - 875,568 (5.66%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0201ba0 - 816,048 (5.27%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ab3f0 - 754,016 (4.87%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf006ee40 - 727,024 (4.70%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0076a90 - 663,872 (4.29%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ad490 - 618,200 (3.99%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00b7bd0 - 616,608 (3.98%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0467bc0 - 612,544 (3.96%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf015fcf0 - 598,400 (3.87%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf021c830 - 584,992 (3.78%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0097818 - 561,224 (3.63%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01a27c0 - 531,816 (3.44%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00bea28 - 531,416 (3.43%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01c2d80 - 522,184 (3.37%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04693e0 - 482,992 (3.12%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf012b158 - 453,256 (2.93%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf147f438 - 424,656 (2.74%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf15ff7d0 - 187,008 (1.21%) bytes.
    Keywords
    com.mysql.jdbc.JDBC4Connection
    sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0
    file:///C:/Documents%20and%20Settings/ss/Local%20Settings/Temp/report2060944296830228239/pages/18.html# Reference Pattern
    Class Name
    Shallow Heap
    Retained Heap
    Percentage
    class java.lang.Thread @ 0xf0003840
    40
    208
    0.00%
    [/code]
    Sample 2
    [code]
    21 instances of "com.mysql.jdbc.JDBC4Connection", loaded by "sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0" occupy 13,827,392 (78.27%) bytes.
    Biggest instances:
    com.mysql.jdbc.JDBC4Connection @ 0xf016d728 - 1,093,888 (6.19%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0094478 - 957,888 (5.42%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0201ba0 - 916,672 (5.19%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ab3f0 - 878,392 (4.97%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf006ee40 - 841,136 (4.76%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf015fcf0 - 758,336 (4.29%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ad490 - 747,240 (4.23%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0076a90 - 735,712 (4.16%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00b7bd0 - 700,912 (3.97%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0467bc0 - 681,336 (3.86%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00bea28 - 668,080 (3.78%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf021c830 - 658,816 (3.73%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0097818 - 638,208 (3.61%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01a27c0 - 605,376 (3.43%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01c2d80 - 582,104 (3.29%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04693e0 - 558,344 (3.16%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf147f438 - 523,952 (2.97%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf012b158 - 508,232 (2.88%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf1603618 - 276,944 (1.57%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf15ff7d0 - 275,288 (1.56%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf148fd70 - 220,536 (1.25%) bytes.
    Keywords
    com.mysql.jdbc.JDBC4Connection
    sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0
    file:///C:/Documents%20and%20Settings/ss/Local%20Settings/Temp/report8548522855535006676/pages/18.html# Reference Pattern
    Class Name
    Shallow Heap
    Retained Heap
    Percentage
    class java.lang.Thread @ 0xf0003840
    40
    208
    0.00%
    [/code]
    Sample 3
    [code]
    21 instances of "com.mysql.jdbc.JDBC4Connection", loaded by "sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0" occupy 17,339,632 (80.79%) bytes.
    Biggest instances:
    com.mysql.jdbc.JDBC4Connection @ 0xf016d728 - 1,228,048 (5.72%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0094478 - 1,144,056 (5.33%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0201ba0 - 1,126,120 (5.25%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ab3f0 - 1,074,552 (5.01%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf006ee40 - 993,912 (4.63%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0076a90 - 931,512 (4.34%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf015fcf0 - 930,952 (4.34%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ad490 - 918,176 (4.28%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00bea28 - 874,512 (4.07%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0467bc0 - 846,368 (3.94%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00b7bd0 - 838,448 (3.91%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf021c830 - 799,184 (3.72%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0097818 - 791,256 (3.69%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01a27c0 - 763,264 (3.56%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01c2d80 - 745,088 (3.47%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf012b158 - 710,704 (3.31%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04693e0 - 704,072 (3.28%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf147f438 - 680,400 (3.17%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf1603618 - 458,472 (2.14%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf148fd70 - 390,984 (1.82%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf15ff7d0 - 389,552 (1.82%) bytes.
    Keywords
    com.mysql.jdbc.JDBC4Connection
    sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0
    file:///C:/Documents%20and%20Settings/ss/Local%20Settings/Temp/report3656754586920669017/pages/18.html# Reference Pattern
    Class Name
    Shallow Heap
    Retained Heap
    Percentage
    class java.lang.Thread @ 0xf0003840
    40
    208
    0.00%
    [/code]

    Dear Masijade,
                          Actually I was confuse with where to put and not to put the try and catch. Below is how my skeleton of my codes will be looking like. I just put one sample query there. If you notice at the very end finally I already have even now dbconn.close(); which closes the pooling connection. The problem  I am worried now is that incase there is any exception how will it be rollbacked. Because if you notice now I lump all the queries under one big try and catch but with your suggestion I have to do try and catch for each query right?
    [code]
    BoneCP connectionPool = null;
      class ConnectionHandler implements Runnable {
        private Socket receivedSocketConn1;
        ConnectionHandler(Socket receivedSocketConn1) {
          this.receivedSocketConn1=receivedSocketConn1;
        Connection dbconn = null;
        public void run() { // etc
         BufferedWriter writeBuffer = null;
         BufferedReader readBuffer = null;
         String capturedMessage="";
         try{
            dbconn = connectionPool.getConnection();
            dbconn.setAutoCommit(false);
            while ((nextChar=readBuffer.read()) != -1){          
              capturedMessage += (char) nextChar;
              if (nextChar == '*')
               try{
                    //all queries here.
                    try{            
                        Statement stmt1 = null;
                        stmt1 = dbconn.createStatement();
                        try{
                          String updateCommand1 = //query
                          count = stmt1.executeUpdate(updateCommand1);
                        finally{
                          if( stmt1 != null ){
                           stmt1.close();
                        else{
                        System.out.println("stmt1 is null in finally close");
                   catch(SQLException ex){
                     ex.printStackTrace(System.out);
                   dbconn.commit
               catch (SQLException ex){
                    ex.printStackTrace(System.out);
                    try{  
                  dbconn.rollback();
               catch (Exception rollback){  
                  rollback.printStackTrace(System.out);
           catch (Exception e){
               e.printStackTrace(System.out);
               try{  
                  dbconn.rollback();
               catch (Exception rollback){  
                  rollback.printStackTrace(System.out);
           finally
         catch (SocketTimeoutException ex){
               ex.printStackTrace();
         catch (IOException ex){
               ex.printStackTrace();
         catch (Exception ex){
               ex.printStackTrace(System.out);
          finally{
            try{
             if ( dbconn != null ){
               dbconn.close();
             else{
              System.out.println("dbConn is null in finally close");
            catch(SQLException ex){
                ex.printStackTrace();
            try{
              if ( writeBuffer != null ){
                writeBuffer.close();
             else{
              System.out.println("w is null in finally close");
            catch(IOException ex){
                ex.printStackTrace(System.out);
    [/code]

  • Memory Leak Java Plugin with Swing Applet

    Hi
    I experience the following problem and desperately need help on this. The Java Plugin (I use Version 1.3.1_02) seems to have a problem in printing Swing Applets.
    The problem can easily be reproduced (at least with NT):
    1) Start Internet Explorer or Netscape (I used 5.5/4.07)
    2) Launch the following demo swing applet
    http://java.sun.com/products/plugin/1.3.1_01a/demos/jfc/SwingSet2/SwingSet2Plugin.html
    3) Print the applet and observe (using task manager) the memory used by the browser process (the memory used by the process will increase every time you hit the print button but never decrease unless you shut down the browser)
    4) Print a couple of times (you may want to pause your print queue) and you will be able to crash your computer
    This seems to be the same bug reported with 4638742. However it says "in progress" for quite some time and I was wondering if some genious might know a work around for this.
    Cheers

    You might want to read an article about memory leaks in Java:
    http://www-106.ibm.com/developerworks/library/j-leaks/

Maybe you are looking for

  • Airplay stops wifi connection

    We had a power outage during the hurricane and I haven't been able to stream music to my Airport base station since - not from my computer, phone or iPad.  I CAN stream from them to my Apple TV.  It appears that my wifi signal goes out after hitting

  • Runtime Analyasis

    1.This is pgm Execute  it will take more time . how to  less time  ? please Sort out  my problem? REPORT  ZRPT_MM_006. TYPE-POOLS: slis. tables : likp, lips, bseg, bkpf, mara, t001w, makt,ekko,ekpo. DATA : gt_fieldcat TYPE slis_t_fieldcat_alv. DATA :

  • SD document flow line items

    Hi all, Can we exclude some line items to appear in the subsequent documents of sales order? Like if I had 5 items in a sales order, I only want three of them to appear in the delivery doc or Advanced ship notice. The other two are filtered using ite

  • Office 365 account 60 minutes

    I have an Office 365 home account, installed Oct. 2014 and am located in the UK. There are 3 users on the account (out of max. 5). One other user is using the monthly 60 minutes Skype credit. I am looking for it on my own account and it doesn't show.

  • VMS 2.4 will support CSAMC in Solaris Version ???

    Hi, i will upgrade my exising VMS2.2 to Solaris and my consideration is to wait until Management Center for Cisco Security Agent (CSAMC) will support. Does sombody know, when CSAMC will implement in future Version?? kindly regards Ronny