• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

java heap problem

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic