In one of the mapreduce program, I was using new Text() during context.write.
context.write(key, new Text(outputRecord.toDelimitedString("|")));
As I am using above statement, I want to know how Text objects are stored and how memory management is being handled. Also want to know about existence of a object value after not referred by any object.
Please let me know about this.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With