Memory Leak with ear file??

A

Aaron

I have been having a problem with a memory leak, and I have tried
numerous things in an attempt to get rid of it. One attempt seemed to
work, but I am curious as to the reason. It seems like when I package
the program together into an ear file, then I will eventually get an
OutOfMemory Error, but packaging it into multiple jar files does not
create the OutOfMemory Error. This doesn't seem to make sence,
because the code inside the files is the same. Does anyone have any
ideas why, or similar experiences?

Thanks,
Aaron
 
R

Robert Olofsson

Aaron ([email protected]) wrote:
: It seems like when I package
: the program together into an ear file, then I will eventually get an
: OutOfMemory Error, but packaging it into multiple jar files does not
: create the OutOfMemory Error.

That seems odd, if you have a leak, you have a leak..
Get a profiler to find the cause.

hprof (in the jdk),
jmp (http://www.khelekore.org/jmp) free, open source,
mjp (http://mjp.sf.net), free, open source

commercial ones:
jprofiler (http://www.ej-technologies.com/products/jprofiler/overview.html),
optimizeit (http://www.borland.com/optimizeit),
jprobe (http://java.quest.com/jprobe/jprobe.shtml),

/robo
 
M

Michael Borgwardt

Robert said:
Aaron ([email protected]) wrote:
: It seems like when I package
: the program together into an ear file, then I will eventually get an
: OutOfMemory Error, but packaging it into multiple jar files does not
: create the OutOfMemory Error.

That seems odd, if you have a leak, you have a leak..

It could make a crucial difference in the classloader mechanism.
 
A

Aaron

Michael Borgwardt said:
It could make a crucial difference in the classloader mechanism.

Hey Michael, could you explain what you mean a little bit more?

Thanks,
Aaron
 
M

Michael Borgwardt

Aaron said:
Hey Michael, could you explain what you mean a little bit more?

Well, obviously to load classes from the EAR you'll have one classloader
that works slightly differently than the multiple ones you'll have when
loading classes from multiple JARs. If everything else is the same, that's
where I'd look for the source of the problem. For example, the memory leak
could occur through a static field in some class which, in a multi-classloader
scenario, can be garbage collected because the classloader itself (and thus
all classes it loaded) became egligible for GC.
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top