Based on earlier suggestions, made changes to free memory by clearing unused variables explicitly with either null or empty values, particularly submissioncontext object. As of now, we are clearing up
inside AddApplicationToSchedulerTransition, RMAppRecoveredTransition & FinalTransition class in RMAppImpl.java. Created a new method to clear all unused fields including above mentioned specific field so that it can be called from above mentioned classes.
Attached initial patch for review.
Couple of junits test cases like
is failing because actual value would have been cleared and hence not matching with the expected value. To confirm whether those fields has been used in application report, checked the AppBlock.java and don't see any usage over there? Please correct me if this understanding is wrong. Based on feedback, we may need to fix the Junit test cases accordingly.
In addition, to understand the memory savings, submitted an simple yarn app to RM (local setup) in series and tried to visualize memory usage using jconsole during GC before and after this code changes. I am not seeing any significant difference as may be because of app is very light and size of each field inside submissioncontext etc.