TLAB ( Thread Local Allocation Buffers )

当在堆上分配新对象时,如果启用了线程本地分配缓冲区(TLAB),则对象会首先放置在TLAB中。每个线程都有自己的TLAB以实现更快的内存分配。通过设置-XX:+UseTLAB可以启用TLAB,并可通过-XX:TLABSize设置其大小,默认为32KB。使用TLAB可能会消耗更多Eden空间,但在创建对象时可能带来轻微的性能提升。
摘要由CSDN通过智能技术生成

  Reprint:http://robsjava.blogspot.com/2013/03/what-are-thread-local-allocation-buffers.html


When new objects are allocated on the heap, if TLAB ( Thread Local Allocation Buffers ) are enabled, the object will first be placed in the TLAB, this buffer only exists within eden space. Each thread has its own TLAB to allow faster memory allocation, as the thread is able to allocate additional memory within the buffer without a lock. The TLAB is pre allocated for each thread. As a thread uses memory within the TLAB it moves a pointer accordingly.


To enable TLAB set ‐XX:+UseTLABYou can set the size allocated to the the TLAB via ‐XX:TLABSize, its default size is 32k or if you prefer you can use the ‐XX:+ResizeTLAB to allow dynamic resizing of the TLAB.

Using TLAB, uses more of your Eden space, but you may get a slight performance benefit when creating objects.
The amount of memory allocated to all your TLAB's will be proportional to the number of threads in your application.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值