Synopsis: | Declare JAXBcontext variables as static. |
Language: | Java |
Severity Level: | 3 |
Category: | Optimization |
Description: |
In order to minimize PermGen memory usage, it is best to declare variables of type JAXBcontext as static. For example: class MyServlet extends HttpServlet { static final JAXBContext context = initContext(); private static JAXBContext initContext() { return JAXBContext.newInstance(Foo.class,Bar.class); } } |