Memory Leak in Inventory Tab

Description

There's a trivially reproducible memory leak on the Inventory tab- every time a different item is selected (i.e., re-populating the equipment info window), pcgen leaks a little memory.

Steps to reproduce:
1. Start pcgen, load some sources
2. create a brand new character
3. switch to inventory tab
4. expand a bunch of tabs, so that a number of items are shown
5. Press/hold down-arrow and then up-arrow to scroll through a bunch of items.
6. watch memory usage climb

In ordinary use creating a low-level character, this ran my system out of memory.

It's reproducible on both 6.07.06 and 6.07.05. I'm happy to test other specific versions.

I've reproduced this with both Starfinder and Pathfinder data.

Please let me know if I can test this on anything else, or if I can produce logs/introspection to help isolate the problem.

Environment

linux, java 8

Activity

Show:
Tom Parker
April 1, 2018, 9:49 PM

Not sure I'm reproducing this with the severity you are seeing.

If this is done, memory use does appear to climb, but it is recoverable memory. If garbage collection is run after scrolling through items the memory is reclaimed, and while there is a nominal increase (a few kilobytes per item), there are a few items we lazily instantiate and cache, so that is an expected outcome and shouldn't be critical to memory use.

Can you run this with your system and click the "Garbage Collection" button in the "Log and Memory Use" and provide values from the log.

Beyond that, what is "a bunch?" I've done 50 and seen no material issue.
What version of Java are you using?
What OS?
How much memory do you provide to PCGen/Java?

Patrick Bogen
April 2, 2018, 12:22 AM

Hi! Thanks for the discussion. Details are below, but after a bit of experimentation I think the problem is the use of JRE 8. With OpenJDK JRE 9, I can no longer reproduce the issue.

1. "a bunch" is really any amount so that there are enough actual items shown such that holding up / down will switch through them.
2. Java version:

3. OS: Debian Linux
4. Memory: This is interesting. I normally run `java -jar pcgen.jar`, i.e., with no max heap size. When I run with `-Xmx128M` I can see GC runs occurring (looking at Log and Memory Usage), and it takes longer for the problem to occur, though it still does. With higher values for -Xmx, it occurs faster.

Patrick Bogen
April 2, 2018, 12:24 AM

to be clear, the memory usage I saw was on the MB-per-item-viewed level, and although from pcgen's perspective GC was freeing memory, when -Xmx was set sanely, from the system perspective, even with -Xmx128M, memory use easily climbed into the several gigabyte range.

So for some reason it seems like JRE 8 wasn't able to free memory, even though the GC was "freeing" it from pcgen perspective.

Assignee

Unassigned

Reporter

Patrick Bogen

Labels

None

Theme

None

Epic/Theme

None

Pending User Input

No

Affects versions

Priority

Minor
Configure