cannot resolve memory leak .

S

Shlomi

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 ?
 
M

Michael Borgwardt

Shlomi said:
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.
 
S

Shlomi

Michael Borgwardt said:
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 !
 
M

Marcus Crafter

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
 
S

Shlomi

Marcus Crafter said:
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 ?
 
J

John C. Bollinger

Shlomi said:
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
(e-mail address removed)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top