...
Wiki Markup |
---|
*heap memory* : "Memory that can be shared between threads is called shared memory or heap memory. All instance fields, static fields and array elements are stored in heap memory.\[...\] Local variables (§14.4), formal method parameters (§8.4.1) or exception handler parameters are never shared between threads and are unaffected by the memory model." \[[JLS 05|AA. Java References#JLS 05]\]. |
Wiki Markup |
*immutable* : \[[Goetz 07|AA. Java References#Goetz 07]\] When applied to an object, this means that "its state cannot be seen to change by callers, which implies that
- all public fields are final,
- all public final reference fields refer to other immutable objects, and
- constructors and methods do not publish references to any internal state which is potentially mutable by the implementation.
Wiki Markup |
---|
Immutable objects may still have internal mutable state for purposes of performance optimization; some state variables may be lazily computed, so long as they are computed from immutable state and that callers cannot tell the difference. |
Immutable objects are inherently thread-safe; they may be passed between threads or published without synchronization." \[[Goetz 07|AA. Java References#Goetz 07]\] |
Anchor |
---|
| initialization safety |
---|
| initialization safety |
---|
|
...