Good examples of value types

Nikolay via Digitalmars-d digitalmars-d at puremagic.com
Thu May 7 11:46:27 PDT 2015


java.lang.String

It is big problem in java. You have pointer to String object with 
fields: hashCode and chars array (UTF-16). But every array is 
object itself. So it is pointer to object again. There is pointer 
compression option in x64 JVM (it uses 32 bits per pointer), but 
in any way it is too many indirection and additional overhead for 
object headers.

FYI
It is possible that Java 9 will have value types (google: IBM 
Java PackedObjects)


More information about the Digitalmars-d mailing list