global vs local (variables and lists) by byte consumption JAVA
<p>I' trying to create a web site and some times I got the PermGen exception.<br>
So I started searching for ways to reduce the amount of created objects and also to reduce the memory consumption.  </p>

<p>I read some articles. But I'm not sure about some things.<br>
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?  </p>

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