This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hi all, Could anyone clear my doubts regarding HttpSession.. 1) Is storing the objects in session a good process with respect to memory management.i mean, does session objects take too much memeory ?? 2) pardon me if this is a dumb question i have String Str1 which has about 3000 charactes.. and another String Str2 which has only 3 characters im putting Str1 in one session and Str2 in another session.. Does Str1 and Str2 (size of the data it holds) play any role in memory consumed by the session ??? Thanks Raj
SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
1) It depends on what you put in the session. I have seen recommendations between 1K and 10K for optimal session size. You can write out a sample session to a file if you want to see how much memory it takes up (see ObjectOutputStream in the API.) 2) Yes, the bigger string will take up more memory. Everything you put in the session uses some memory. Even a field set to null will take up a byte.