No Text
in Hadoop is not immutable. It can't be, because Hadoop's serialization process implicitly forbids immutability.
In this particular case, context.write
will just serialize the content of Text
into a byte buffer directly inside the call, so the Text
object will be trashed soon after the method returns.
Keep in mind that there is still a stack reference to the Text
object as it is passed into the method, so it won't be eligible for garbage collection.