Skip to content

WordlistRandomWords a terrible waste of memory #676

@kdvolder

Description

@kdvolder

We are using the cf-java-client in what is supposed to be a 'lightweight' server process for a vscode-extension.

Some heap dump analysis has revealed that, cf java client accounts 6.5Mb of JVM heap. This is a lot as its nearlt 50% of all the heap used.

Things get worse if we allocate more than one client instance. Each additional instance again costs 6.5Mb. This very quickly makes it so the java-client consumes most of the memory in the heap compared to anything else.

Interestingly, it looks like a class called 'WordlistRandomWords' accounts for the bulk of the memory used. To make matters worse, this huge 'wordlist' is allocated allover again for each new instance. I assume the list is identical on each instance so, given the size of this object, it should probably be shared.

Also... the only thing our tool does at the moment is retrieve a list of services and builpacks, neither of which I imagine requires the use of the random words list. The word list should probably not be loaded into memory unless it is actually needed. And it should probably be stored in some kind of a cache which allows evicting it when its not been used awhile as well.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions