title: Hold reference to object for future method calls or fetch the object every time in long methods
body: <pre><code>class A {
      void method1() {
          B b = new B();
          C c = new C();
  
          // Option 1
          List&lt;Object&gt; cachedObject = b.method1();
          c.method1(cachedObject);
          c.method2(cachedObject);
  
          // Option 2
          c.method1(b.method1());
          c.method2(b.method1());
      }
  }
  
  class B {
       List&lt;Object&gt; method1() {
       }
  }
  
  class C {
       void method1(List&lt;Object&gt; a) {
       }
  
       void method2(List&lt;Object&gt; a) {
       }
  }
  </code></pre>
  
  <p>In option 2, does the argument to c.method1() be available for garbage collection after it returns turn out to be better compared to option 1 where we cache the object and use it in both method calls, c.method1() and c.method2() considering there are time consuming operations happening between c.method1() and c.method2() calls and hence the cached object is still referenced during that time and not available for garbage collection.</p>
  
  <p>From memory utilization perspective, which option would work out better considering the object returned by b.method1() is huge(500MB+) ?</p>