Browsing projects by Tag(s)

Select a tag to browse associated projects and drill deeper into the tag cloud.

Showing page 1 of 1

Flyweights are small handle classes for immutable data that intelligently share their content to prevent memory duplication. The Flyweight class has been designed as simply as possible and can be used as a drop-in replacement for T. ProblemImagine an application that has hundreds or thousands of ... [More] users. Each user has a first and last name, stored as separate strings in memory. It is highly likely that some of them share the same first or last names; if there are 20 people with the first name "Richard" then 20 duplicate instances of "Richard" will exist in memory. SolutionThe best way to demonstrate how Flyweights can address this problem is with a very simple example: Flyweight a = "Richard"; Flyweight b = "Richard"; Flyweight c = "Richard"; Flyweight d = "Richard"; Flyweight e = "Richard";With regular System.String objects, five separate copies of "Richard" would exist concurrently, even though they are all identical. Flyweights can detect this, and will only store one object in memory. DocumentationFlyweight details and examples UnsafeFlyweight details and examples Design and rationale Extending the library Acknowledgements DownloadThe Flyweights source is currently available in SVN, or via the downloads page. Requirements.NET framework 2.0 or higher. [Less]

0
 
  0 reviews  |  0 users  |  562 lines of code  |  0 current contributors  |  Analyzed about 2 years ago
 
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.