Recently I came up with the idea of simple pattern for dynamic creation of object. And I real love it.
I am sure that that "wheel" was invented and named. Could someone could point to some GOF pattern?

Problem: have huge number of objects that I don't want to have all initialized at the beginning. All are instances of one class.

I want to use an object and then free the memory (or allow garbage collection),
each object is correlated to some string, so I have a map ({"str1", obj1}, {"str2",obj2},...)
When the request comes with str1 I need to return obj1,....
I could have (pseudocode)

very nice explanation, generally I know factory, and lazy evaluation (which terrifies me as always my first thought is Singleton Pattern - which I started to hate). But I could not fit my concept into them, as it is composition of both. Simple "what" and "how" view makes all clear! Thanks a lot!
–
GadolinSep 30 '10 at 9:16

As other have said before, this is called "Factory pattern". Well done on figuring that out for yourself.

If you want to take this one step further, create a map which just contains the class name (a String). That allows you to read the names from a file and you end up with "Inversion of Control" which leads to "Dependency Injection".

The factory pattern is a creational design pattern used in software development to encapsulate the processes involved in the creation of objects.
The creation of an object often requires complex processes not appropriate to include within a composing object.

The object's creation may lead to a significant duplication of code, may require information not accessible to the composing object, may not provide a sufficient level of abstraction, or may otherwise not be part of the composing object's concerns.

Some of the processes required in the creation of an object include determining which object to create, managing the lifetime of the object, and managing specialized build-up and tear-down concerns of the object.