RFR: 8254739: G1: Optimize evacuation failure for regions with few failed objects [v19]

Albert Mingkun Yang ayang at openjdk.java.net
Fri Nov 5 10:59:42 UTC 2021


On Fri, 5 Nov 2021 10:34:48 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/g1EvacFailureObjectsSet.cpp line 131:
>> 
>>> 129: 
>>> 130:   _offsets.drop_all();
>>> 131: }
>> 
>> Having some destructive operations (`drop_all`) inside a method named `iterate` could come as a surprise, IMO. If I understand this correctly, the following would be problematic.
>> 
>> 
>> evac_failed_objects.iterate(closure1);
>> ...
>> evac_failed_objects.iterate(closure2);
>
> drop_all just returns buffers to free list, it will not destruct the buffers. So, iterate multiple times is OK, because next time it will get memory from free list or allocate a new buffer. Hope this answer your question.

Since `drop_all()` resets all counters (e.g. `_num_allocated_nodes`), the subsequent iteration will think the array is empty, won't it?

-------------

PR: https://git.openjdk.java.net/jdk/pull/5181



More information about the hotspot-gc-dev mailing list