As you know, when memory is moved to L caches on the processor, it is moved using caches, thus optimizing cache performance ...
Well in java, when we define an jmm array, it guarantees that the memory for each element will be allocated sequentially. However, if we have an array of links, these links may randomly appear in different places in memory.
My question is that java allocates memory of real objects sequentially? What optimizations do we have under the hood for this?
For example, if we declare int [], we are sure that all of them are actually sequential in memory, but if we define NewType (for example, struct) in which there are two int fields and declare NewType [], java will compute and save is the actual memory sequential or not?
source
share