{"id":296,"date":"2014-01-21T14:01:29","date_gmt":"2014-01-21T14:01:29","guid":{"rendered":"http:\/\/www.smr.co.uk\/?p=296"},"modified":"2014-01-21T14:01:29","modified_gmt":"2014-01-21T14:01:29","slug":"java-garbage-collection","status":"publish","type":"post","link":"http:\/\/www.smr.co.uk\/?p=296","title":{"rendered":"Java Garbage Collection"},"content":{"rendered":"<h2>TLAB and the Cost of Object Allocation<\/h2>\n<p>To avoid contention each thread is assigned a Thread Local Allocation Buffer (TLAB) from which it allocates objects. Using TLABs allows object allocation to scale with number of threads by avoiding contention on a single memory resource. Object allocation via a TLAB is a very cheap operation; it simply bumps a pointer for the object size which takes roughly 10 instructions on most platforms. Heap memory allocation for Java is even cheaper than using malloc from the C runtime. When a TLAB is exhausted a thread simply requests a new one from the Eden space. When Eden has been filled a minor collection commences. \u00a0[<a href=\"http:\/\/www.infoq.com\/articles\/Java_Garbage_Collection_Distilled\">ref<\/a>]<\/p>\n<p><a href=\"https:\/\/weblogs.java.net\/blog\/2006\/05\/04\/understanding-weak-references\">Weak References<\/a> explained.\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TLAB and the Cost of Object Allocation To avoid contention each thread is assigned a Thread Local Allocation Buffer (TLAB) from which it allocates objects. Using TLABs allows object allocation to scale with number of threads by avoiding contention on &hellip; <a href=\"http:\/\/www.smr.co.uk\/?p=296\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a> <a href=\"http:\/\/www.smr.co.uk\/?p=296\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8,11],"tags":[],"class_list":["post-296","post","type-post","status-publish","format-standard","hentry","category-java","category-technology"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=296"}],"version-history":[{"count":0,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/296\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}