DHuckaby/Prime — pull request #16 by spennington (2012-09-27 20:52:55+00:00)
Title: Introduce a cache into the ImageManager so it can reuse an old ByteArrayOutputStream

Requesting multiple images from the network in a short period of time
can cause significant garbage collection as a new ByteArrayOutputStream
is created for each image requested from the network. Use an object
pool to keep around old ByteArrayOutputStreams for future use.

Important: this implementation introduces a memory leak becuase the
ByteArrayOutputStream cache is never emptied. I believe there are two
viable options:

1.) Limit the size of the cache and accept the fact that the ImageManager
has a memory overhead that will grow to some maximum.

2.) Remove items from the cache if they are not used within a certain
amount of time. Essentially a poor mans garbage collection.