2025-07-03 21:36 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003660Spring engineGeneralpublic2013-04-23 20:33
Reporterbibim_ 
Assigned ToKloot 
PrioritylowSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version94.1 
Target VersionFixed in Version 
Summary0003660: Spring 94 + HealthBars widget causing big memory usage increase
DescriptionTest system:
  CPU: AthlonXP 3000+
  OS: Windows NT 5.00.2195 SP4
  RAM: 2 GB
  Video: GeForce 7950GT 512MB

Test replays:
  Size: 4v4 (2 E323 + 2 KAIK) vs (2 E323 + 2 KAIK)
  Map: Tangerine
  Game: BA 7.72
  Duration: replays stopped after 10 minutes in game (~ 200 units)

Results for spring.exe process:
  Spring 91.0, HealthBars enabled:
    Peak mem usage: 376MB
    Page faults: 185 354
  Spring 91.0, HealthBars disabled:
    Peak mem usage: 374MB
    Page faults: 178 966
  Spring 94.1, HealthBars enabled:
    Peak mem usage: 550MB
    Page faults: 1 448 351
  Spring 94.1, healthBars disabled:
    Peak mem usage: 381 MB
    Page faults: 199 942

I stopped after 10 minutes each time in order to be able to do the tests quickly, as it's enough to notice the memory increase even if it doesn't seem that big. However, with real life multiplayer games with more units, Spring takes all available memory and my system swaps so much that the game becomes unplayable after about 15 minutes. This can be solved either by disabling HealthBars, either by switching back to Spring 91.

I've set the issue severity to minor and priority to low because I didn't find any evidence of reproducibility on other systems than mine.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0010315

bibim_ (reporter)

Last edited: 2013-03-29 19:36

View 3 revisions

I did some additional tests on a different system (Win7 / i5 / 4GB). On this system, enabling HealthBars widget with Spring 94.1 / BA 7.75 didn't increase peak memory usage that much (better Win7 memory management?).
However, following results show a really big increase in page faults number when HealthBars widget is enabled:

With HealthBars:
  Initial page faults (just when Spring finishes loading): 195 215
  Page faults after 3 minutes in game (normal speed): 2 283 778
   => page faults triggered during 3 minutes of game at normal speed: 2 283 778 - 195 215 = 2 088 562
Without HealthBars:
  Initial page faults (just when Spring finishes loading): 194 974
  Page faults after 3 minutes in game (normal speed): 241 832
  => Page faults triggered during 3 minutes of game at normal speed: 241 832 - 194 974 = 46 858

So, during the first 3 minutes of this replay, I got 44 times more page faults for spring process just by enabling HealthBars.
These results were obtained using following replay: http://planetspads.free.fr/spads/tmp/20130328_214620_Tangerine_94.sdf (I tested several times to avoid side effects, and could reproduce it 100%).
Weirdly enough, the problem isn't triggered by all replays. For some replays (even with bigger number of players and/or units), I have very similar page faults numbers with or without HealthBars.

Could it be related to the map? (reclaimable features?) Because I noticed the big increase in page faults rate is observed from the start, even when no unit is even spawned yet...

~0010316

user744

http://code.google.com/p/zero-k/source/detail?r=9790 maybe relevant?

~0010332

jK (developer)

test?

~0010379

abma (administrator)

Last edited: 2013-04-03 20:30

View 2 revisions

@bibim & knorke:

can you try with the latest develop build as it shows lua mem usage in debug view? this should help to find the cause...

~0010386

bibim_ (reporter)

Same test as in issue description, but this time I played it at 1x speed (which seems to make things worse), with current develop (94.1.1-105-g4169a3d):

Peak mem usage: 1.36GB
Page faults: 7 117 916

(once again, these values are for about 200 units only...)

I had HealthBars enabled during the 10 minutes of the test, and lua allocated memory was continuously changing very fast between ~100MB and ~860MB (maybe more, because I didn't keep an eye on it during the whole 10 minutes => maybe a peak usage line would be useful...).
Then after these 10 minutes I disabled HealthBars, and lua allocated memory stayed between 5MB and 6.5MB.

~0010481

bibim_ (reporter)

Is there anything planned concerning this, or is it an expected behavior for Spring 94 to have 44 times more memory pagefaults for Spring process when HealthBars is enabled?

~0010482

Kloot (developer)

you did mark it low priority...

~0010483

bibim_ (reporter)

Yes I did, because initially I couldn't find any evidence of reproducibility on other systems than my old system, and also because jk told me in #sy it was likely due to my GPU drivers. However I did some additional tests afterward (cf first note), which seem to show there is a problem on modern systems also, even if it doesn't produce clear memory increase but just big page faults increase (hence performance decrease I guess?). I would have changed it to normal priority if I could...

Anyway, my question wasn't meant to urge anyone, just to get some feedback as I'm not even sure it is considered as a defect.

~0010484

Kloot (developer)

Last edited: 2013-04-16 21:25

View 2 revisions

It's unusual but not necessarily a defect, since you said that

1) the problem isn't triggered by all replays, even with bigger number of players and/or units
2) the big increase in page faults rate is observed from the start

So let's say the problem is triggered only by maps with "many" features on them. Any game (or replay) on such a map should then consistently reproduce it and a simple modification of the healthbars widget (s.t. features are ignored) should be enough to prove or disprove this hypothesis. Here's what you do: the next game(s) you play on a suspect map, disable BA's unit_healthbars.lua and use the attached unit_healthbars_mantis3660.lua instead. Measure the memory usage and page fault count and compare both to the unmodified version. If there is a signicant difference, then we can decide to look further.

~0010485

bibim_ (reporter)

1) & 2): maybe the problem is triggered not only by reclaimable features of the map, but also by units corpses. So replays containing lots of unreclaimed corpses would produce it more than replays containing lots of units but where all corpses are reclaimed fast.

I don't have time right now to play a game and do once again all the measurements (I didn't get why I should wait to play a game to do the tests, instead of testing with a known replay producing the problem btw). However I quickly tested this new HealthBars widget with the replay I used for previous tests ( http://planetspads.free.fr/spads/tmp/20130328_214620_Tangerine_94.sdf ), and the difference is seen from the first seconds: this new widget behaves correctly regarding page faults.

~0010487

Kloot (developer)

First assumption would be easy to test, load a featureless map like Comet Catcher and issue /cheat /give 500 armflash_dead. Replays will also work of course.

If you could now remove lines 822 ("--[[") and 842 ("--]]") and report back how it behaves then, that would be enough information to determine if the issue is caused by the rendering or by the update portion of the widget.

~0010488

bibim_ (reporter)

When removing these lines, the widget produces lots of page faults from the start.

~0010489

Kloot (developer)

Last edited: 2013-04-16 23:15

View 2 revisions

Then most likely the GetVisibleFeatures function is to blame, but that did not change much between 91 and 94.

Are you able to compile Spring yourself?

~0010492

bibim_ (reporter)

No, I don't have any operational environment for the moment to build current Spring version for Windows.

~0010498

jK (developer)

please test with 2nd done commit
things to check for:
* just run Spring 1h and see if LuaUI is still active after that

~0010511

bibim_ (reporter)

"First assumption would be easy to test, load a featureless map like Comet Catcher and issue /cheat /give 500 armflash_dead"

I just did the test and it triggers the high page faults rate problem too.

~0010549

Kloot (developer)

Issue has been addressed for 95.

Reopen if any recent development build (of the past 5 days) still shows these symptoms.
+Notes

-Issue History
Date Modified Username Field Change
2013-03-29 14:40 bibim_ New Issue
2013-03-29 19:22 bibim_ Note Added: 0010315
2013-03-29 19:30 bibim_ Note Edited: 0010315 View Revisions
2013-03-29 19:36 bibim_ Note Edited: 0010315 View Revisions
2013-03-29 19:55 user744 Note Added: 0010316
2013-03-31 01:03 jK Changeset attached => spring develop cc709bf5
2013-03-31 01:03 jK Note Added: 0010332
2013-03-31 04:07 abma Description Updated View Revisions
2013-03-31 04:08 abma Assigned To => jK
2013-03-31 04:08 abma Status new => feedback
2013-04-03 20:30 abma Note Added: 0010379
2013-04-03 20:30 abma Note Edited: 0010379 View Revisions
2013-04-04 15:43 bibim_ Note Added: 0010386
2013-04-04 15:43 bibim_ Status feedback => assigned
2013-04-16 16:32 bibim_ Note Added: 0010481
2013-04-16 19:20 Kloot Note Added: 0010482
2013-04-16 20:13 bibim_ Note Added: 0010483
2013-04-16 21:17 Kloot File Added: unit_healthbars_mantis3660.lua
2013-04-16 21:21 Kloot Note Added: 0010484
2013-04-16 21:25 Kloot Note Edited: 0010484 View Revisions
2013-04-16 21:27 Kloot File Deleted: unit_healthbars_mantis3660.lua
2013-04-16 21:27 Kloot File Added: unit_healthbars_mantis3660.lua
2013-04-16 22:16 bibim_ Note Added: 0010485
2013-04-16 22:44 Kloot Note Added: 0010487
2013-04-16 22:56 bibim_ Note Added: 0010488
2013-04-16 23:13 Kloot Note Added: 0010489
2013-04-16 23:15 Kloot Note Edited: 0010489 View Revisions
2013-04-16 23:57 bibim_ Note Added: 0010492
2013-04-17 19:00 jK Changeset attached => spring develop 848099e3
2013-04-17 19:02 jK Note Added: 0010498
2013-04-20 14:14 bibim_ Note Added: 0010511
2013-04-23 20:33 Kloot Note Added: 0010549
2013-04-23 20:33 Kloot Status assigned => resolved
2013-04-23 20:33 Kloot Resolution open => fixed
2013-04-23 20:33 Kloot Assigned To jK => Kloot
+Issue History