Skip to content

Reduce memory consumption for caches [SPR-13093] #17684

Closed

Description

@spring-projects-issues

Phil Webb opened SPR-13093 and commented

Currently several classes in the framework use ConcurrentReferenceHashMap with soft references for caching. Unfortunately soft references only get cleared when the JVM is completely out of memory making it appear that Spring is consuming a lot of resources.

We could create a dedicated MemoryCache abstraction with additional bounds to ensure that no individual cache is consuming too much memory.

Another, perhaps simpler approach, could be to clear caches after the ApplicationContext has loaded. The ResolvableType cache especially could benefit from this approach.


Affects: 4.1.6

Issue Links:

0 votes, 5 watchers

Activity

  1. spring-projects-issues commented on Jun 15, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    AbstractApplicationContext resets the ResolvableType and CachedIntrospectionResults caches after the refresh phase now.

    Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions