• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Size of a session object

 
Marilyn Monickam
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Could you let me know if there is a way to determine the size of a session object or any object?
Thanks
Marilyn
 
Greg Charles
Sheriff
Posts: 2987
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no sizeof operator like in C, if that's what you mean. Java tries to abstract you from the idea of the physical memory. However, if you use a profiler like OptimizeIt, you can get some idea of how many objects of each type have been allocated, and how much memory they take.
On the other hand, if you meant how to get a count of the attributes currently contained in a session (and you're talking about an HttpSession), I don't see an obvious way. You have to getAttributeNames(), then cycle through the Enumeration to count them.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic