Increasing number of loaded classes. Class leak?

I

isenseie

Hi there,

I am concern about the high number of classes loaded by one
application. Using JConsole I see linear time raising in the number of
classes loaded, after monitoring that for about 24 hours the number of
loaded classes continues increasing (more than 100.000), while the
number of unloaded classes is less than 0.5%. So far no memory leak
was observed after 24 hours.

I guess there is a logical leak in the application but I don't
understand why this has no effect on the memory usage.

- Do you know about the possible reasons / side effects of this ugly
class leak behavior?

- I've tried to find out more info about the class loading, but it
seems to be a kind of tricky to self manage the loading/unloading
process.

I'd really appreciate any information/documentation/experiences.

Thanks in advance.
 
C

charlesbos73

I guess there is a logical leak in the application but I don't

Not necessarily in the application.

understand why this has no effect on the memory usage.

If you're on the Sun VM, take dumps of the running application
and watch what Sun calls the "PermGen" memory (this is some
Sun-specific weirdity).

There are documented cases where the JVM is at fault.

For example there's a longstanding bug related to Tomcat + Sun VM +
Hibernate
where everybody denies the fault, yet there's a fault somewhere.

You replace any of these three components and the class leak goes
away.

- Do you know about the possible reasons / side effects of this ugly
class leak behavior?

The possible reason falls down to a bug somewhere: either in the app,
in some API/framework, or in the VM. The bug may only be triggered
by some condition/combination of technologies, but it doesn't change
the fact that there's a bug somewhere.

Side effect on a Sun VM, for example, might be the application exiting
or becoming seemingly stalled (been there, seen that), spouting out of
PermGen space error (which won't happen on a non-Sun VM for they don't
have the concept of "PermGen" ;)
 
I

isenseie

thanks, I'll mock some components to check from where is it coming.

anyway, how could be possible that the number of loaded classes is so
high (more than 100.000) ?
 
I

isenseie

Perhaps the code loads dynamically created classes, for example:

thx.

yes, with this line:

JAXBContext.newInstance(clazz);

I was creating a new class. I just fixed it, and now it seems to be
ok :)
 
R

Roedy Green

thx.

yes, with this line:

JAXBContext.newInstance(clazz);

that creates new objects, but not new classes, right?
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Deer hunting would be fine sport, if only the deer had guns."
~ William S. Gilbert of Gilbert and Sullivan
 

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,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top