Currently as users make requests forms are added to the UifFormManager which is added to session. If the forms are not properly cleared out they keep getting added until memory is filled up. We need to provide some safeguard to keep the form storage from going over a certain configured limit of memory.
Here are some thoughts:
1) Enhance UifFormManager to keep track of the memory the forms are consuming (if possible, if not might have to go by form count)
2) Introduce Rice configuration parameter that configures how much memory a particular manager can hold (note this would be on a per user session bases).
3) As the memory usage goes about the threshold, serialize out forms to the database. Need to create a new service like SessionDocumentService that can store general forms to the database. If a request comes in for a form that is not in memory, attempt to get it from the database. Might be good to keep a last referenced time so we keep the most recently used forms in memory.
4) Implement a timeout on form objects. This is independent of the users session. So if a form has not been accessed in X number of minutes, it will be cleared from the memory or database. This should be a Rice configuration parameter as well