2015-08-25

OutOfMemoryError :PermGen space or Metaspace Example: JVM Exception/Error

3 comments:

  1. Hi..I would like to know what you did to resolve this issue? It would be nice if you could share the solution.

    ReplyDelete
    Replies
    1. There are several approaches, this is only simulation here. Example,
      - if your cause for web framework (spring, hibernate) which is very common due to reflection based operation, you need change calling type(introduce weak references).
      -We found effective to reboot web server after each deploy(it will delete old class loaders)
      -Upgrade to java 8 VM (1 of Prod issue solved) because, meta space is large area now. You may use sizing parameter to increase size.
      -And, if you have leak, you need get multiple heap dumps, get the costly class loader or classes, change implementation to reduce it. , It is often not possible for 3rd party libraries, so, introduce proxy classes to use those 3rd party libraries and keep as weak reference to be GC collected.
      [idea is simple, either eliminate usages, or CG collectable, increase size might solve issues temporarily]

      Delete