Reputation: 1480
My team decided to use Struts 2.x but I am confused because Struts 1.x actions are singletons, multi-threaded on the action like servlets. Struts 2.x creates new instances on every request, which increases heap memory usage.
Does using Struts 2.x require more memory?
Upvotes: 0
Views: 161
Reputation: 160181
Object instantiation in Java is very cheap, so there's no performance problem.
The garbage collector takes care of efficiently reclaiming memory of any objects created during the call, so there's no significant memory impact.
The advantages however are obvious: there's no shared state between requests.
Upvotes: 5