Fixed memory leak in Collection class with a new implementation.

#478 - memory consumption optimized from 12,377,160 bytes to 6,053,976.
Merge pull request #482 from marcj/perf2

Fixed memory leak in Collection class with a new implementation.