Project

General

Profile

Bug #3926

SPH/VAB context menu (tweakable UI) seems to leak memory on every redraw

Added by bac9 over 9 years ago. Updated about 8 years ago.

Status:
Closed
Severity:
Normal
Assignee:
-
Category:
Controls and UI
Target version:
-
Start date:
01/02/2015
% Done:

100%

Version:
Platform:
Win32
Expansion:
Language:
English (US)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

The title and attached gif are self explanatory: it seems that the tweakable UI triggers some sort of a memory leak. The effect seems to be proportional to the count of KSPFields controlled through tweakable UI present in the context menu. Stock parts with two tweakables like MK2 adapter cause 200-500kb raise in memory use on every context menu opening and value change. A test part with an empty PartModule declaring ten UI_FloatRange KSPFields allocates up to 3 megabytes of additional memory on every redraw. By spending 5-8 minutes in the SPH tweaking a stock part oxidizer/LF values, we can see RAM use raise by 400mb, and parts with custom PartModules using a dozen or more sliders are capable of triggering out of memory crash in the same amount of time.

KSPEvent buttons do not seem to be affected - the issue is reproduced only with context menus exposing fields through tweakable UI (like UI_FloatRange). Memory use is raising on every redraw of such a menu, and drops on average by relatively fixed amount of 0.5-1mb every time the menu is closed (regardless of how much memory was allocated while the menu was used).

stock_example.gif (763 KB) stock_example.gif bac9, 01/02/2015 01:41 PM
accelerated_use.gif (658 KB) accelerated_use.gif bac9, 01/03/2015 03:52 AM
accelerated_example2.gif (228 KB) accelerated_example2.gif bac9, 01/03/2015 04:16 AM
#3926-TweakableTest.zip (267 KB) #3926-TweakableTest.zip Place folder in gamedata Squelch, 01/07/2015 05:20 PM
5062
5079
5080

History

#1 Updated by Claw over 9 years ago

I'll have to say that I'm not quite able to replicate this. By that I mean that I'm seeing continued increases in memory usage, but monkeying with the tweakable sliders doesn't seem to cause this for me. I'm actually just sitting in the VAB without selecting any parts or doing anything and I can sit and watch the memory usage climb. It's not quite jumping 2MB at a time, but it's steadily climbing. Messing with the tweakables did not cause jumps in memory usage for me above what I was already seeing.

I also tried turning off the ground crew and turning off music with no change in the memory increase.

#2 Updated by bac9 over 9 years ago

5079

Yes, VAB/SPH already seem to leak memory at the rate of 0.1-0.3mb per second (not always, but usually, for reasons unclear), but I'm suspect that there is another leak linked to KSPFields/tweakable UI. I am attaching another example, with a part containing a new PartModule with nothing but some KSPFields with UI_FloatRange tweakable UI attached. While background memory use is steadily rising no matter what I do, it's pretty noticeable how the rate is accelerated when I drag the slider in this context menu, which suggests that the issue is harder to notice with stock parts only because it's proportional to field count exposed in UI.

#3 Updated by bac9 over 9 years ago

5080

Another example, to further illustrate how the rate accelerates and how it's not linked to a particular slider (to remind, that's just an empty module with KSPFields, no logic that can cause any leaks is present in it).

#4 Updated by Squelch over 9 years ago

I'm having trouble reproducing this.

I'm using stock craft, and using the stock tweaks available while monitoring KSP in Perfmon on Win64. I do not see any appreciable rise in memory usage. In fact it looks remarkably stable while manipulating tweaks on engines in the editor.

Does this only happen with added KSPFields as tweakables?
Which tool is being used to monitor memory use?

The gifs certainly would indicate an increase in memory, and I strongly believe there are some memory issues that are causing some odd behaviour, but I cannot see anything wrong with this particular scenario. The variable observations would indicate that we might all be looking at different things, and under different circumstances.

Could you please provide a full reproduction recipe and upload any example files?

#5 Updated by Squelch over 9 years ago

After discussion on IRC with bac9, he kindly provided a sample part and plugin. See attached.

It is a copy of the T-100 tank with tweaks enabled. Can be found next to the original in parts tab.

I am still unable to reproduce the increased memory use.

I will put a video together showing the results I get, and upload shortly.

#7 Updated by Squelch almost 9 years ago

  • Status changed from New to Confirmed
  • % Done changed from 0 to 10

The max and min values and the number of steps on the slider can have an effect on the outcome. This issue has now been identified and can be confirmed.

#8 Updated by Squelch over 8 years ago

  • Platform Win32 added
  • Platform deleted (Windows)

#9 Updated by Squelch about 8 years ago

  • Status changed from Confirmed to Closed
  • % Done changed from 10 to 100

Since been resolved and confirmed to be fixed.

Also available in: Atom PDF