
-
Integer contains meta data, not only the int value. The size is usually 4 times of int. An array is bigger since it needs to store the length
-
HashSet is a wrapper of HashMap. An empty HashSet/HashMap already contains 16 objects (default size) and the size is more 100 bytes. Everytime we do “put”, it will create new object “Entry”.
-
HashTable is synchronized and HashMap is not. Vector (also Stack) is synchronized and ArrayList is not.
-
Overhead of collections:

-
Java application memory

-
Compressed reference/compressed OOPs could reduce java heap usage when migrate from 32 bit to 64 bit platform. But it doesn’t do the same for java native heap
-
How heap and stack work together:





近期评论