Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-13783

ReflectionUtils cache uses up a fairly big chunk of heap even

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.2.3
    • Fix Version/s: 4.2.4
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      I noticed in a memory constrained application (simple Spring Boot app with -Xmx32m) I was seeing a lot of ReflectionUtils in the YourKit "biggest objects" list, and drilling down into it reveals a couple of references to caches. They look like they are designed to be garbage collected, but apparently they are not. The app was sitting happily at 23MB heap, but I wanted to see if I could do better, so I added reflective hack calls to clear the two caches in ReflectionUtils and miraculously the heap shrank (after GC) down to about 14MB, and was stable from there even nuder load. I feel maybe this merits clearing the cache at least optionally in the startup phase of an app, either in Spring or in Boot (where we could make it optional for low memory apps).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              david_syer Dave Syer
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 24 weeks, 1 day ago