<div dir="ltr">Hi Stefan,<div><br></div><div>Thanks for your detailed explanation. My confusion is gone now.</div><div><br></div><div>Best Regards,</div><div>-- Guoxiong</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 2, 2024 at 6:20 PM Stefan Karlsson <<a href="mailto:stefan.karlsson@oracle.com">stefan.karlsson@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Guoxiong,<br>
<br>
On 2024-03-31 15:54, Guoxiong Li wrote:<br>
> Hi all,<br>
><br>
> I notice the ZCounterOutOfMemory is only increased in the call link<br>
> `ZAllocatorEden::alloc_object -> ZHeap::out_of_memory`.<br>
> Should we increase this counter in the method <br>
> `ZAllocatorEden::alloc_tlab`<br>
<br>
I don't think we should. When we fail alloc_tlab, the code will continue <br>
and try a direct allocation with alloc_object. See:<br>
<br>
HeapWord* MemAllocator::mem_allocate_slow(Allocation& allocation) const {<br>
   // Allocation of an oop can always invoke a safepoint.<br>
debug_only(allocation._thread->check_for_valid_safepoint_state());<br>
<br>
   if (UseTLAB) {<br>
     // Try refilling the TLAB and allocating the object in it.<br>
     HeapWord* mem = mem_allocate_inside_tlab_slow(allocation);<br>
     if (mem != nullptr) {<br>
       return mem;<br>
     }<br>
   }<br>
<br>
   return mem_allocate_outside_tlab(allocation);<br>
}<br>
<br>
> and other allocation methods such as <br>
> `ZAllocatorForRelocation::alloc_object`?<br>
<br>
Relocations will never fail. If we run out of memory during relocation, <br>
the object will be in-place compacted into its current ZPage.<br>
<br>
> And should we move the incremental code like `ZHeap::out_of_memory` to<br>
> the allocation methods of `ZObjectAllocator`, which is a lower level <br>
> class for allocation.<br>
<br>
If we should do anything here, I think it is to move the call to <br>
ZHeap::out_of_memory() to ZCollectedHeap::mem_allocate.<br>
<br>
Cheers,<br>
StefanK<br>
<br>
><br>
> Any ideas are appreciated. Thanks.<br>
><br>
> Best Regards,<br>
> -- Guoxiong<br>
<br>
</blockquote></div>