Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7594577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:27:14+00:00 2026-05-30T21:27:14+00:00

By released I mean there are no references to the classloader remaining. We’re running

  • 0

By “released” I mean there are no references to the classloader remaining.

We’re running into a problem where a frequently-redeployed Java EE application eats up permgen space. Analysis shows that a singleton in the Java EE app has passed references to application-classloader objects outside of the application (in violation of Java EE rules) and isn’t clearing them when the app is undeployed.

Assuming there are no other references remaining to the singleton or the class object, will the singleton’s finalize() be called when its class’s classloader is released? I’d like to clear the rogue in-bound references there. Or am I in a catch-22 where finalize won’t get called until the classloader itself can be garbage-collected – and thus will never be called because of the rogue external references?

The main question here is perhaps:

Will a class object be garbage-collected in this case where its classloader can’t be yet? This may be dependent on the specification of classloader behavior, or may be implementation-dependent.

References (the other kind! ;-)) would be appreciated, but aren’t necessary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:27:16+00:00Added an answer on May 30, 2026 at 9:27 pm

    A class with a static reference to it, will is eligible for garbage collection only, if the class loader is eligible for GCing and there are no other references to it.

    A class or interface may be unloaded if and only if its defining class loader may be reclaimed by the garbage collector.

    http://java.sun.com/docs/books/jls/third_edition/html/execution.html#12.7

    Furthermore every class has a reference to its classloader. So a class loader is not eligible for GCing as long as there are references to classes loaded by it or objects of those classes from a non collectible objects.

    The finalizer is run some time after an object becomes eligible for garbage collection and before the actual GC takes place.

    The approach to free incoming references, that prevent GCing, in a finalizer does not work. The finalizer will not be called as long as such references exist because they prevent the object from becoming eligible for garbage collection. For example you cannot break this reference chain from the inside:

    singleton instance <--- singleton class <--- class loader <--
    <-- any class loaded by that class loader  <-- any object of such a class
    <-- object loaded by another classloader referencing such an object or class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I always designed/developed/released a software or web project myself/independent activity using java/vb.net and php
The Problem I'm running multiple invocations of some external method via an ExecutorService .
I released a free and pro version of an app. To prevent full functionality
I released an app that uses Google LVL to the Market many months ago.
Last Thursday we just released a new version of our website. The big change
I noticed SmashingMagazine released a Smashing Network feature, which includes other website's posts. This
WCAG 2.0 is released should we follow only WCAG 2.0 guideline or we should
i have released a version 1 on some app in the market. Can anyone
i've recently released an app to the App store, i went to have a
As EF 4.0 released, more support to SQL server Stored procedure. Complex Type can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.