[Bug] Every `#layout load` leaves the previous layout in memory
Maintainers usually reply within 5 days
Assessment
This issue has not been assessed yet.
Description
What happened
Genie's memory goes up each time a layout is loaded and does not come back down. With text in the windows the step is large: about 45 MB a load with 2,000 lines in each of two windows, and more for the first load.
A script that loads a layout when it starts adds that much at every start, so a window that runs all day keeps growing.
What you expected
About the same memory after a layout load as before it, since the same windows with the same text are on screen.
Steps to reproduce
- Start Genie. No connection is needed.
- Put text in two windows. I used
fill.cmdbelow, which echoes 2,000 lines into the game window and 2,000 into Thoughts. - Type
#layout save global memtest. - Note the memory of the Genie5 process, then type
#layout load memtestfive times, noting it after each.
RssAnon from /proc/PID/status:
| MB | |
|---|---|
| after filling the windows | 278 |
| after load 1 | 394 |
| after load 2 | 441 |
| after load 3 | 489 |
| after load 4 | 532 |
| after load 5 | 574 |
| 30 seconds later | 558 |
fill.cmd, ten lines to each window per pass, 200 passes:
var n 0
loop:
math n add 1
put #echo [%n.0] You swing a heavy sword at a rock troll. A rock troll attempts to dodge, but fails. The sword lands a solid hit to the troll's left arm.
put #echo >Thoughts [%n.0] Your mind hears someone thinking, "anyone selling a decent set of plate armor near the crossing bank today?"
(the same two lines nine more times, numbered .1 to .9)
pause 0.05
if %n < 200 then goto loop
put #echo FILL DONE
Environment
- OS + version: Ubuntu 26.04
- Genie 5 version: 5.0.1-beta.5
- Install type: AppImage
- Connection mode: not connected (the steps need no connection)
Logs / session capture
FILL DONE
[script] fill done
[layout] saved 'memtest' (global)
[layout] loaded 'memtest' (global)
[layout] loaded 'memtest' (global)
[layout] loaded 'memtest' (global)
[layout] loaded 'memtest' (global)
[layout] loaded 'memtest' (global)
The loads themselves work. Nothing is printed about memory.
Anything else
Cause, as far as I can read it:
Controls/FindInWindow.csadds a handler to the tool'sFindInWindowModeleach time a text window's view is built (model.PropertyChanged += …for the find box,model.JumpRequested += …for the scroller) and never removes it.- The model belongs to the tool and outlives the view. After a layout load it still holds the old find box and the old scroller, and through their parents the whole previous layout with its lines.
- I assume a float or a re-dock does the same, since those rebuild the view too. I only measured layout loads.
The same is true of main as of d1373a5.
Workaround: none that I know of, other than loading a layout less often. Restarting Genie gives the memory back.
I have a fix with tests (the find box and the scroller listen to the model only while they are in a window), and a pull request follows.
- Dominant language
- C#
- Stars
- 2
- Forks
- 5
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 22
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GenieClient/Genie5
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
GenieClient/Genie5#496 ·
Maintainers usually reply within 5 days
-
enhancement g4-regression
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
GenieClient/Genie5#494 ·
Maintainers usually reply within 5 days
-
area:ui-dock enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
GenieClient/Genie5#462 ·
Maintainers usually reply within 5 days
-
area:mapper bug est:<1d P2
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
GenieClient/Genie5#449 · 1 comment ·
Maintainers usually reply within 5 days
-
[Bug] Maps ▸ Update from Official Repo / Repair Maps give no notification of success or failurePossibly taken A pull request linked to this issue is open or already merged. Openarea:mapper area:updater bug est:<1d P3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
GenieClient/Genie5#423 · 1 assignee ·
Maintainers usually reply within 5 days
All issues in GenieClient/Genie5
Similar issues
-
documentation good first issue kind:task level:starter size:s
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Arggon/ArggonStores#66 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[Tool] MockAPIOpenhas-image has-license has-readme new-tool ready-to-approve repo-verified
Difficulty 1/5 Under an hour Newbie friendliness 72/100
shanselman/TinyToolTown#956 ·
Maintainers usually reply within 2 days
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[Bug]: Native build script prints a traceback when Git is missing from PATHPossibly taken @Jaisuryan-web claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
KnifeLemon/Filee#1953 ·
Maintainers usually reply within 1 day