Finite member variables make GC better?

This question is a continuation of this , but requires a more specific scenario.

Suppose we have the following class:

public class Person {
    private Foot left, right;

    public Person(Foot left, Foot right) {
        this.left = left;
        this.right = right;
    }
}

I was wondering if the next class could be optimized from the point of view of the GC if we turned it into the following:

public class Person {
    private final Foot left, right;

    public Person(Foot left, Foot right) {
        this.left = left;
        this.right = right;
    }
}

, , . , , GC ( ) , , Person . , Foot; .

, , , ( )?

+3
3

, Java GC (*). , final . ( , , final.

, final JIT . final. , (.. ) (, ).

(* Java . , - JVM, , , ... concurrency, ..)

+7

, GC , , JVM final.
final , Java-. , . final ( Java-)

: , , , . GC. , GC .

+1

Java . , .

0

All Articles