I' trying to create a web site and some times I got the PermGen exception.
So I started searching for ways to reduce the amount of created objects and also to reduce the memory consumption.
I read some articles. But I'm not sure about some things.
For example, is it better to declare lists outside of a method (global), or to create them inside a method? What's the difference in terms of memory consumption in this case? If I declare them as local that means that after they are used the garbage collector will collect them and thus will release space at the heap?
Can anyone propose ways to reduce more memory consumption and to reduce the amount of created objects (is @Autowired a better way to declare on object)?
If you are getting an Out-of-memory exception regarding PermGen, then reducing the number and size of your objects most likely won't help (because they will be taking up space in the Heap, not your PermGen)
This answer PermGen Out of Memory reasons should help with the causes of PermGen problems
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With