Void method() {
  // this creates a large object 
  Biggie big = readIt();
  // this condenses it
  Item item = findIt(big);
  // we'd really like to reuse big's memory
  // big = null;
  // this method is going to run a long time
  parseIt(item);
}

Example 3: A method is supposed to read through a file, parse items out of it, and deal with certain elements in it.

Back to Article