I have a list element which is populated via a query, this is then run through a for loop which sends this list to the front end, a jsp and prints them.
Wanted to know if by calling the list.clear() outside the for loop, it will clear the list object, so will this lead to better memory management? or should one use the weakhashmap for such activities?
In web applications using so many third party jar files and containers, profiling is a good way to know your memory usage, but even then while coding if there is a way to know the best approach to a particular situation it would be easier to adopt an approach. e.g. a mostly static site could benefit with hibernate or toplink type caching, but a site with couple of thousand entries in a day might require a different approach, wherein which objects to cache would make a lot of sense.
Any resources recommended which clearly define which approach to adopt for a particular situation would be greatly appreciated.
The advantage of java is choice, the disadvantage of java is choice!