in reply to Re: Doubt about fly-weight objects.
in thread Doubt about fly-weight objects.
IIRC the point of flyweights is when you have a boatload of instances of a class and having each instance carry around the entire state would take a huge amount of memory.
No, all of the data still exists, it is just all stored in one big heap in the class, rather than piecemeal with each obect instance. Saying that this saves memory usage is kind of like saying that dropping something heavy from your hands will reduce the total mass of the universe. Flyweight objects are so named because they, themselves, consume next-to-no memory, but the total memory used is not reduced; it's just used in a different place (within the same process).
------------ :Wq Not an editor command: Wq
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Doubt about fly-weight objects.
by Fletch (Bishop) on May 17, 2005 at 17:48 UTC | |
by etcshadow (Priest) on May 18, 2005 at 02:41 UTC | |
by adrianh (Chancellor) on May 19, 2005 at 08:13 UTC |
In Section
Seekers of Perl Wisdom