Skip to main content

Flyweight

  • Chapter
  • First Online:
  • 1629 Accesses

Abstract

A Flyweight (also sometimes called a token or a cookie) is a temporary component that acts as a smart reference to something. Typically, Flyweights are used in situations where you have a very large number of very similar objects, and you want to minimize the amount of memory that is dedicated to storing all these values. Let’s take a look at some scenarios where this pattern becomes relevant.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    The size of a string actually depends on the bitness of the operating system as well as the version of .NET that you are using.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Dmitri Nesteruk

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Nesteruk, D. (2019). Flyweight. In: Design Patterns in .NET. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4366-4_12

Download citation

Publish with us

Policies and ethics