13. Edenからのアロケーション
Copyright 2018 FUJITSU LIMITED
o = new Object();
bottom top end
lock(Eden);
top = top + size;
unlock(Eden);
Bump The Pointer
bottom top end
12
size
14. TLAB (Thread-Local Allocation Buffer)
Copyright 2018 FUJITSU LIMITED
スレッド1スレッド2
Eden領域をスレッドごとに分割して割当て
ロックが不要に
13
lock(Eden);
top = top + size;
unlock(Eden);
15. Fast Allocation
Copyright 2018 FUJITSU LIMITED
https://www.oracle.com/technetwork/java/javase/memorymanagement-whitepaper-150215.pdf
only requiring around 10 native instructions
Memory Management in the Java
HotSpot Virtual Machine
Bump the Pointer + TLAB で実現
14
24. Escapeの例
Copyright 2018 FUJITSU LIMITED
int foo(String name) {
Person person = new Person(name);
return person.id();
}
void foo(String name) {
Person person = new Person(name);
register(person);
}
NoEscape
ArgEscape
23
25. Escapeの例
Copyright 2018 FUJITSU LIMITED
class bar {
Person person;
void foo(String name) {
person = new Person(name);
}
}
GlobalEscape
24
30. Scalar Replacement 例
Copyright 2018 FUJITSU LIMITED
int foo(String name, int age) {
Person person = new Person(name, age);
return person.getAge();
}
class Person {
String name;
int age;
Person(String name, int age) {
this.name = name;
this.age = age;
}
}
29