2021年1月26日

JVM - TLAB(Thread Local Allocation Buffer)本地线程分配缓冲

摘要: 引入TLAB的原因 多线程环境下,在堆上创建对象很容易造成线程不安全现象。 可能出现线程A正在给对象O1分配内存M,指针还没来得及修改,线程B又同时使用了内存M来给对象O2分配内存的情况。 如何开启TLAB? 开启本地线程分配缓冲(Thread Local Allocation Buffer,TLA 阅读全文

posted @ 2021-01-26 20:10 frank_cui 阅读(375) 评论(0) 推荐(0)

JVM - 栈上分配 + 逃逸分析

摘要: 总结 //例1:User类型的对象u就没有逃逸出方法test public void test(int x,int y ){ String s = “”; User u = …. ….. } //例2:User类型的对象u就逃逸出方法test public User test(int x,int y 阅读全文

posted @ 2021-01-26 19:01 frank_cui 阅读(86) 评论(0) 推荐(0)

导航

levels of contents