-
Enhancement
-
Resolution: Duplicate
-
P4
-
6, 7
-
x86
-
windows_2000, windows_xp
Name: rmT116609 Date: 11/11/2003
A DESCRIPTION OF THE REQUEST :
java.util.logging.LogManager is broken because it doesn't allow Logger's to be released (i.e. once loaded they are loaded forever).
This has two problems -
a) creation of lots of Loggers results in memory being lost that can never be reclaimed / released.
b) In an environment (like an application server) where apps get loaded and unloaded the java 1.4 Logger/LogManager API can be broken because an old instance of the logger is loaded and if you had a resource bundle sub-class associated with it you get a class cast exception when the logger is used again.
JUSTIFICATION :
Should be obvious from the description.
a) If you've finished with a logger you should be able to release it - knowing that there will be a cost re-acquiring it.
b) For App Servers.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
LogManager.removeLogger(String name) - deletes the cached instance of Logger for name and removes free the logging hierarchy.
ACTUAL -
Currently memory is lost and can't force a reload of bundles.
You can "trick" things by setting the locale to be a different value (which causes the resource bundle cache to reload) - but this is nasty and implementation dependant.
---------- BEGIN SOURCE ----------
// This will cause memory to be exhausted.
for (int i = 0; i < 10000000; i++) {
Logger log = Logger.getLogger(new Object().toString());
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is no workaround to the memory problem (a).
for (b) you can "trick" things by setting the locale to be a different value (which causes the resource bundle cache to reload) - but this is nasty and implementation dependant.
(Incident Review ID: 225012)
======================================================================
A DESCRIPTION OF THE REQUEST :
java.util.logging.LogManager is broken because it doesn't allow Logger's to be released (i.e. once loaded they are loaded forever).
This has two problems -
a) creation of lots of Loggers results in memory being lost that can never be reclaimed / released.
b) In an environment (like an application server) where apps get loaded and unloaded the java 1.4 Logger/LogManager API can be broken because an old instance of the logger is loaded and if you had a resource bundle sub-class associated with it you get a class cast exception when the logger is used again.
JUSTIFICATION :
Should be obvious from the description.
a) If you've finished with a logger you should be able to release it - knowing that there will be a cost re-acquiring it.
b) For App Servers.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
LogManager.removeLogger(String name) - deletes the cached instance of Logger for name and removes free the logging hierarchy.
ACTUAL -
Currently memory is lost and can't force a reload of bundles.
You can "trick" things by setting the locale to be a different value (which causes the resource bundle cache to reload) - but this is nasty and implementation dependant.
---------- BEGIN SOURCE ----------
// This will cause memory to be exhausted.
for (int i = 0; i < 10000000; i++) {
Logger log = Logger.getLogger(new Object().toString());
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is no workaround to the memory problem (a).
for (b) you can "trick" things by setting the locale to be a different value (which causes the resource bundle cache to reload) - but this is nasty and implementation dependant.
(Incident Review ID: 225012)
======================================================================
- duplicates
-
JDK-6274920 JDK logger holds strong reference to java.util.logging.Logger instances
- Closed
- relates to
-
JDK-4811930 RFE: Cannot remove Loggers from LogManager
- Closed