Flyweight pattern

A screenshot of LibreOffice's Writer package.
Text editors, such as LibreOffice Writer, often use the flyweight pattern.

In computer programming, the flyweight software design pattern refers to an object that minimizes memory usage by sharing some of its data with other similar objects. The flyweight pattern is one of twenty-three GoF design patterns.

In other contexts, the idea of sharing data structures is called hash consing.

The concept was coined and first extensively explored by Paul Calder and Mark Linton in 1990 to efficiently handle glyph information in a WYSIWYG document editor. Similar techniques were already used in other systems, however, as early as 1988.