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-tp19256471p19269323.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to