uCosminexus Application Server, API Reference Guide

[Contents][Index][Back][Next]

Appendix A. JavaAPI Classes in which Leakage of the Java Heap Memory Occurs Easily

When you use a JavaAPI class, the instances of the JavaAPI class are created in the Java heap memory. However, when the methods of the JavaAPI classes, described in Table A-1 and Table A-2, are used and the conditions described in the tables are fulfilled, the instances other than the JavaAPI classes will also be also created in the Java heap memory.

The created instances of the user-created classes are stored in the Java heap memory until the JavaAPI classes are deleted. Therefore, before you realize it, the usage of the Java heap memory might increase and leakage of the Java heap memory might occur.

However, as for the JavaAPI classes described in Table A-2, you can also delete the instances of the user-created classes.

The classes in which leakage of the Java heap memory occurs easily are listed in separate tables below, depending on the existence of the methods for deleting the instances. Table A-2 also describes the methods for deleting the user-created instances.

Reference note
Some changes might be made in the version 08-00 and later versions regarding the JavaAPI classes in which leakage of the Java heap memory occurs easily, and the conditions of leakage and the methods for deleting the instances of the user-created classes.

Table A-1 List of classes in which leakage of the Java heap memory occurs easily (When no deletion method exists)

JavaAPI class name Conditions for creating instances of the user-created classes in the Java heap memory
java.lang.ClassLoader When ProtectionDomain, specified in an argument of the defineClass() method, is correlated to a user-created class.
java.net.URL When the URLStreamHander class, created by URLStreamHandlerFactory during the creation of the URL class instances, is a user-created class.
java.text.DateFormat When super() is invoked by the constructor of a user-created class that inherits the DateFormat class.
java.util.logging.Level When super() is invoked by the constructor of a user-created class that inherits the Level class.
java.util.logging.LogManager When a user-created class, that inherits the Logger class in the argument of the addLogger() method, is specified.
java.util.logging.Logger When the getAnonymousLogger() method and the setParent() method are invoked by a user-created class that inherits the Logger class.
javax.accessibility.AccessibleBundle When a user class object is set up in a value of a pair that consists of a key and a value maintained in a user-implemented class corresponding to the resource bundle name specified in the argument of the toDisplayString() method.
javax.print.attribute.standard.MediaSize When super() is invoked by the constructor of a user-created class that inherits the MediaSize class.
java.rmi.server.UnicastRemoteObject When a user-created class is specified in the arguments (RMIClientSocketFactory and RMIServerSocketFactory) of the exportObject() method.

Table A-2 List of classes in which leakage of the Java heap memory occurs easily (When a deletion method exists)

JavaAPI class name Conditions for creating instances of the user-created classes in the Java heap memory Method for deleting the instances of the user-created classes
java.beans.Introspector When a user-created class is specified in an argument (beanClass) of the getBeanInfo() method. Execute the flushCaches() method and the flushFromCaches() method.
java.beans.PropertyEditorManager When a user-created class is specified in an argument (editorClass) of the registerEditor() method. Specify null in editorClass of the registerEditor() method.
java.util.logging.Logger When a user-created class that inherits the Handler class is specified in an argument of the addHandler() method. Execute the removeHandler() method.
javax.imageio.ImageReader When a user-created class that inherits the IIOReadWarningListener class is specified in an argument of the addIIOReadWarningListener() method. Execute the removeIIOReadWarningListener() method.
When a user-created class that inherits the IIOReadProgressListener class is specified in an argument of the addIIOReadProgressListener() method. Execute the removeIIOReadProgressListener() method.
When a user-created class that inherits the IIOReadUpdateListener class is specified in an argument of the addIIOReadUpdateListener() method. Execute the removeIIOReadUpdateListener() method.
javax.imageio.ImageWriter When a user-created class that inherits the IIOWriteProgressListener class is specified in an argument of the addIIOWriteProgressListener() method. Execute the removeIIOWriteProgressListener() method.
When a user-created class that inherits the IIOWriteWarningListener class is specified in an argument of the addIIOWriteWarningListener() method. Execute the removeIIOWriteWarningListener() method.
javax.naming.InitialContext When a user-created class is specified in an argument (propVal) of the addToEnvironment() method. Execute the removeFromEnvironment() method.
javax.naming.spi.NamingManager When a user-created class is specified in an argument of the getContinuationContext() method. Implement close() of the acquired Context, and then execute super().
javax.print.attribute.HashAttributeSet When a user-created class is specified in an argument of the add() method. Execute the remove(Attribute) method and remove(Class) method.