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)?