Tag: fragmentation

为什么Java对象中存在内部碎片,即使每个字段都是4字节对齐的?

介绍: 我使用JOL(Java对象布局)工具来分析Java对象的内部和外部碎片以用于研究目的。 在这样做的时候,我偶然发现了以下内容: x@pc:~/Util$ java -jar jol-cli-0.9-full.jar internals sun.reflect.DelegatingClassLoader # WARNING: Unable to attach Serviceability Agent. You can try again with escalated privileges. Two options: a) use -Djol.tryWithSudo=true to try with sudo; b) echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope # Running 64-bit HotSpot VM. # Using compressed oop with 3-bit shift. # Using compressed klass […]