File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Size of a session object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Size of a session object" Watch "Size of a session object" New topic
Author

Size of a session object

Marilyn Monickam
Ranch Hand

Joined: Jun 05, 2001
Posts: 66
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

Joined: Oct 01, 2001
Posts: 2848
    
  11

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Size of a session object