I read a lot about memory allocation for Strings lately and can\'t find any details if things are the same with Java 8.
How much memory space would a String like
"Alexandru Tanasescu" uses 104 bytes. This is how to get the size
long m0 = Runtime.getRuntime().freeMemory(); String s = new String("Alexandru Tanasescu"); long m1 = Runtime.getRuntime().freeMemory(); System.out.println(m0 - m1);
Note: run it with -XX:-UseTLAB option