The optimization that fulfills your first two bullets is called an Object Pool. It works by
- creating a pool of objects when the program starts,
- maintaining references to those objects in a list so that they don't get garbage collected,
- handing objects to your program from the pool as needed, and
- returning objects back to the pool when you're done using them.
You can find an example class that implements an Object Pool using a