You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/06/13 23:20:12 UTC

DO NOT REPLY [Bug 20765] New: - Boolean objects created with new waste memory, cost time

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20765>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20765

Boolean objects created with new waste memory, cost time

           Summary: Boolean objects created with new waste memory, cost time
           Product: Axis
           Version: current (nightly)
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Basic Architecture
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: Eric.D.Friedman@wellsfargo.com


java.lang.Boolean objects should never be created with new() -- as Boolean
instances are immutable, there is no need to ever have more than 2 instances of
Boolean in a system.  The singleton instances work in many cases; when a boolean
expression has to be evaluated to choose between the two, the Boolean.valueOf()
method should be used to find the singleton instance rather than creating a new
one.  Adhering to this policy saves memory and allows boolean comparisons to be
implemented as reference compares (==) rather than value comparisons, which is
somewhat faster.