java.util.LinkedList clear() improvement
gkorland at gmail.com
Thu Aug 27 10:23:19 PDT 2009
First I don't think this is the same issue, in the clear case, there's
no reference from the root to any of the entries.
Second as I know any MarkAndSweep GC should not suffer from such issue.
Since the sweep phase should collect any unreachable entry no matter
how many dead references point to it.
On Thu, Aug 27, 2009 at 7:01 PM, Christopher Hegarty -Sun Microsystems
Ireland<Christopher.Hegarty at sun.com> wrote:
> I think this change was made to address:
> 4863813: Stressing single LinkedList from multiple threads causes heapspace
> to completely
> Guy Korland wrote:
>> How does it help the GC?
>> As I understand the M&S algorithm, there's no real advantages in doing so.
>> In fact in many places to "null" references is considered to be an
>> anti pattern in java.
>> On Thu, Aug 27, 2009 at 4:37 PM, Tom Hawtin<Thomas.Hawtin at sun.com> wrote:
>>> Guy Korland wrote:
>>>> It seems like linkedList.clear() can be easily fixed to O(1) instead of
>>> The code is like that on purpose(!). It was done to help GC, in mustang
>>> IIRC. There really isn't a problem with clear() being O(n) - it's going
>>> take at least O(n) to populate it, and in reality *many* times more
More information about the core-libs-dev