I extended the JspStateManagerImpl also for this reason (and for some simple multi window support).
I removed the Map with the old views stored as weak references because they are not useful at all in my App. Benefit is that GC is more performant and that possible errors (View could not be restored) are exactly reproducible and do not depend on memory consumption. Michael -----Original Message----- From: Daniel Niklas [mailto:[EMAIL PROTECTED] Sent: Dienstag, 2. September 2008 14:33 To: [email protected] Subject: Re: statesaving - memory consumption Hi Simon, Simon Kitching wrote: > > The idea is that by setting NUMBER_OF_VIEWS_IN_SESSION, a webapp can > guarantee to support a certain number of back-button clicks - at the JSF > level at least. > > Or that when two windows are open on the same webapp, that the user can > perform NUMBER_OF_VIEWS_IN_SESSION clicks in one window before the other > window starts to misbehave. > Ok, our application doesn't need something like that, because we have session beans... Simon Kitching wrote: > > The "weak" map stuff then tries to make life nice for the user; when > there is memory to spare then it tries to keep as many old views as > possible, so that even more than NUMBER_OF_VIEWS_IN_SESSION clicks will > work. But when memory is low, only NUMBER_OF_VIEWS_IN_SESSION clicks are > guaranteed to work. > It might be a problem, that many of these objects are created and the memory increases very fast. That means much effort for garbage collection! And most people (?!) doesn't need this mechanism at all. Simon Kitching wrote: > > The original code used the default constructor for ReferenceMap, which > uses strong refs to keys but weak refs to values. The key object here is > not large; it is the value (which is the whole UIViewRoot) that is held > weakly. However nothing *ever* clears the keys for this map. > Yes, 1.1.5 uses the default constructor for ReferenceMap. But this was not the problem! Entries of ReferenceMap will be removed when the garbage collection runs (and there is no other hard reference to the value), even if the corresponding key is hardly referenced! No memory leak here. Simon Kitching wrote: > > I agree with your second posting, a weak references isn't a good > choice here, soft references would be better, but no idea > what was going wrong with 1.1.5. I'll check this. > Thanks for your answers Daniel -- View this message in context: http://www.nabble.com/statesaving---memory-consumption-tp19256471p192693 23.html Sent from the MyFaces - Users mailing list archive at Nabble.com.

