Context: |
Objects of a type may be heavyweight but tend to have equal values and are read-only all or most of the time (e.g. character string). |
||||||||
Challenge: |
To prevent resource duplication system wide, hiding the existence of the Flyweight Pool. |
||||||||
Skill: |
|||||||||
Participants: |
|
||||||||
Signature: |
Flyweight contains Smart Pointer Counters by key and creates Resources. Resource Proxies share Smart Pointer Counter, obtained from the Flyweight. Smart Pointer Counter contains Resource and notifies the flyweight. |
||||||||
Used patterns and idioms: |
Singleton, Reference-counting proxy. |
||||||||
Used by: |
Character string and similar widely used low-level types with significant duplication overhead. |
||||||||
Scope: |
General (system programming). |