Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is a Leaking Class Loader?

class leaking loader
0
10 Posted

What is a Leaking Class Loader?

0
10

A leaking class loader is just like any other leak: an object which is still around even though it is not used by the application anymore. Because a class loader keeps references to all classes it defined, this is particularly wasteful in terms of perm space. If you then have a system with regular deploy-undeploy-deploy cycles like an application server, these leaks will quickly eat up the available perm space. And increasing the perm space is no option here… The above mentioned article uses the following example: The servlet LeakServlet is logging something using the Java logging facilities and then writes a Hello World! into the output stream. Please note the anonymous inner class assigned to theCUSTOMLEVEL attribute (Level’s constructor is protected). I deployed this servlet inside a WAR and then re-deployed it again. Then I took a heap dump (see my previous blog or Memory Analyzer’s WIKI). Running the Class Loader Overview, I get this result: As you can see, there are two instances

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123