• Post Reply Bookmark Topic Watch Topic
  • New Topic

java heap problem  RSS feed

 
mamidi venkat
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ALL,

I wanted to know request object will take more heap or session will take heap memory
becaused iam java heap memory problem.


prasad
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They both will take the same amount of memory. The issue here is the lifespan. Requests are short lived, and as soon as the request has finished its attributes can be cleaned up immediately. Sessions on the other hand can be active for hours at a time, all the while its attributes are kept in memory. you should therefore use request attributes unless you need them between multiple requests from the same user; a session is the only option in those cases.

As for your memory problem, sometimes web applications simply need a lot of memory, more than your servlet container (Tomcat?) can provide. If this is the case, try increasing the memory the servlet container can use instead.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!