cannot resolve memory leak .

Discussion in 'Java' started by Shlomi, Nov 10, 2003.

  1. Shlomi

    Shlomi Guest

    Hi
    I have a web application that runs on Orion web server using jdk 1.3.1
    after monitoring my application I noticed a wired behavior, I saw that
    the total memory of the VM keeps growing (
    runtime.getRuntime().totalMemory() ) while the
    'free Memory' (Runtime.getRuntime().freeMemory()) stays almost the
    same, the total memory of the process that is being used by the VM
    keeps growing .
    it looks like the GC free memory to the VM but the VM keeps it and
    doesn't free it

    after a while , I am getting error messages
    "java.lang.OutOfMemoryError <<no stack trace available>>" and the
    free memory descends to almost 0.
    forcing the GC doesn't really work.

    after reading allot of the threads that were discussed over here , I
    suspect that the problem is in the jdbc driver or the way i am using
    it.
    I have one class that all the DB access is being made from and every
    method (such as "getRow()" , "GetTable()" etc ... ) close the
    connection and the resultset in its finally statement and returns a
    Vector as a result.
    I use a connection pool to get connections from the DB.
    I really don't know where to start from or what am I doing wrong, can
    any one give me a lead ? or how should I trace the problem ?
    Shlomi, Nov 10, 2003
    #1
    1. Advertising

  2. Shlomi wrote:
    > after reading allot of the threads that were discussed over here , I
    > suspect that the problem is in the jdbc driver or the way i am using
    > it.


    Don't suspect, get hard facts. Use a profiler.
    Michael Borgwardt, Nov 10, 2003
    #2
    1. Advertising

  3. Shlomi

    Shlomi Guest

    Michael Borgwardt <> wrote in message news:<bonl9m$1gehik$-berlin.de>...
    > Shlomi wrote:
    > > after reading allot of the threads that were discussed over here , I
    > > suspect that the problem is in the jdbc driver or the way i am using
    > > it.

    >
    > Don't suspect, get hard facts. Use a profiler.


    just tried to use 'Jprofiler' but it seems like it have a problem with
    both the jdk version that i am using(1.3.1) and the webserver (orion
    1.45) version.

    can you please recommend me one to use ?
    Thanks !
    Shlomi, Nov 10, 2003
    #3
  4. Hi Shlomi,

    In a previous project I used OptimizeIT which I found to be quite good,
    you could run your application inside of it, perform a task, refresh the
    GC and see if there were any objects with references left over.

    Perhaps give it a try? They used to have a free evaluation period as well.

    Cheers,

    Marcus

    Shlomi wrote:
    > Michael Borgwardt <> wrote in message news:<bonl9m$1gehik$-berlin.de>...
    >
    >>Shlomi wrote:
    >>
    >>>after reading allot of the threads that were discussed over here , I
    >>>suspect that the problem is in the jdbc driver or the way i am using
    >>>it.

    >>
    >>Don't suspect, get hard facts. Use a profiler.

    >
    >
    > just tried to use 'Jprofiler' but it seems like it have a problem with
    > both the jdk version that i am using(1.3.1) and the webserver (orion
    > 1.45) version.
    >
    > can you please recommend me one to use ?
    > Thanks !
    Marcus Crafter, Nov 10, 2003
    #4
  5. Shlomi

    Shlomi Guest

    Marcus Crafter <> wrote in message news:<>...
    > Hi Shlomi,
    >
    > In a previous project I used OptimizeIT which I found to be quite good,
    > you could run your application inside of it, perform a task, refresh the
    > GC and see if there were any objects with references left over.
    >
    > Perhaps give it a try? They used to have a free evaluation period as well.
    >
    > Cheers,
    >
    > Marcus
    >


    Hi marcus (and all the others)


    well , I downloaded ,installed and used OptimizeIT tool to find leaks,
    I think I found some problems with the application but I don't know
    what to do with them.

    I will try to give you a short description of my application:
    it is a server that handle http requests , process them and give
    back an answer.
    the processing is quite complicated and have allot of work with the
    DB (mssql db).

    I started my application , took a snapshot of the heap, simulated some
    transactions and took another snapshot of the heap.
    the result was that the biggest difference between the two snapshots
    was made by Microsoft jdbs objects, in the reference graph, I searched
    for a reference to some objects that I wrote but I haven't found any.

    I really don't know what to do next, I doubled checked the code to see
    if I am closing all the connections and result sets, and I believe I
    do.

    can someone please give me a hint or some idea how to solve this
    problem ?
    Shlomi, Nov 17, 2003
    #5
  6. Shlomi wrote:
    > well , I downloaded ,installed and used OptimizeIT tool to find leaks,
    > I think I found some problems with the application but I don't know
    > what to do with them.
    >
    > I will try to give you a short description of my application:
    > it is a server that handle http requests , process them and give
    > back an answer.
    > the processing is quite complicated and have allot of work with the
    > DB (mssql db).
    >
    > I started my application , took a snapshot of the heap, simulated some
    > transactions and took another snapshot of the heap.
    > the result was that the biggest difference between the two snapshots
    > was made by Microsoft jdbs objects, in the reference graph, I searched
    > for a reference to some objects that I wrote but I haven't found any.
    >
    > I really don't know what to do next, I doubled checked the code to see
    > if I am closing all the connections and result sets, and I believe I
    > do.
    >
    > can someone please give me a hint or some idea how to solve this
    > problem ?


    You don't have enough information yet. It is natural that you see many
    unreachable JDBC objects after the kind of test you describe. You don't
    know whether these represent part of the leak, or whether they would
    have been garbage collected sometime later. I would suggest that you
    run the test you describe in a loop, capturing each heap dump along the
    way (and making sure to flush it to disk), until you get your
    OutOfMemoryError. Some JVMs also have an option to log GC activity --
    you might want to turn that on if available. You want to see what
    objects are on the heap at the time of the Error, because the leaked
    memory must reside in some of those objects. The JVM is not supposed to
    throw an OutOfMemoryError if it can obtain the memory it needs by any
    means available to it, especially including GC.


    John Bollinger
    John C. Bollinger, Nov 17, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. @lex-kid
    Replies:
    2
    Views:
    2,391
    @lex-kid
    Jul 7, 2003
  2. sufia
    Replies:
    1
    Views:
    3,036
    @lex-kid
    Jul 6, 2003
  3. Replies:
    1
    Views:
    10,147
  4. Simon
    Replies:
    11
    Views:
    620
    Matthias Buelow
    Jan 28, 2008
  5. Sébastien Cottalorda

    cannot solve a memory leak

    Sébastien Cottalorda, Jun 16, 2009, in forum: Perl Misc
    Replies:
    3
    Views:
    134
    Sébastien Cottalorda
    Jun 17, 2009
Loading...

Share This Page