Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: How to remove memory leak detected message ?  (Read 5534 times)

narf03

  • Lieutenant
  • **
  • Posts: 53
    • View Profile
How to remove memory leak detected message ?
« on: November 16, 2022, 09:37:27 PM »

I have this annoying memory leak detected message that pause the game, technically the message just annoy me and i cant do anything about it, can i either tell the game not to display the message or i can remove certain module so the memory detector just dont function at all ? just prevent it to detect. i dont mind the game crash once every few hours, but just not 1 message every minute or so. i have 32G ram.
Logged

theriddick

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: How to remove memory leak detected message ?
« Reply #1 on: November 17, 2022, 06:13:41 PM »

When it appears its basically telling you to restart the game. Be nice if game had less memory leaks however :)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: How to remove memory leak detected message ?
« Reply #2 on: November 17, 2022, 06:27:50 PM »

(More than likely it's an issue with one of the mods you're running. Though, always the possibility that some kind of leak snuck through in vanilla too, of course...)

But: if you open up data/config/settings.json, you can set "doRAMandVRAMChecksWhenRunningWithMods" and that should turn it off.
Logged

vok3

  • Lieutenant
  • **
  • Posts: 74
    • View Profile
Re: How to remove memory leak detected message ?
« Reply #3 on: November 17, 2022, 07:29:50 PM »

I've mentioned seeing this memory leak error in several different mod threads and was told by multiple (fairly prominent) people that it didn't matter and I could just ignore it and keep playing.

My professional background is in software testing and the idea that one should "just ignore" a memory leak error popup sends me into a frothing rage. 

Either this advice is correct, which means the leak popup is a false positive and the conditions producing it should be carefully re-examined at the earliest possible moment, or the leak popup is correct and their advice is not correct and they should not be giving it and whatever code is producing the conditions that produce the popup REALLY needs to be looked at carefully.  I don't like either of those possibilities, because on both sides of the question it looks like there are fairily competent developers who - judging by results visible in the base game and in certain mods - should know what they're doing.

The conditions where I seem to consistently be able to produce this error usually involve one of the following sets of conditions:
1) playing with an absolutely extravagant mod like UAF, especially in conjunction with multiple other mods (my guess is the tourism fleets it provokes from all other factions contribute to multiplying the load fairly quickly)
2) playing with Nex + Vayra's Sector + a fair number (10-20ish) of other faction mods, starting a new game, and then loading a game while in the campaign rather than exiting to the menu and loading from there
3) playing with Nex + Apex + a fair number of other faction mods, starting a new game, and then loading a game while in the campaign rather than exiting to the menu and loading from there
4) playing with Nex + Idoneus, fighting (as Idoneus) a reasonably large battle (with control points) and then attempting to load any save game at all under any conditions - the only way to avoid this is to shut the application down and restart it, loading fresh
5) there are a smattering of other cases I've seen where large battles will set me up for a leak if I try loading afterward; it seems to be specific to certain factions, but I haven't been systematic about looking into those other cases yet
6) playing with mods that do a lot of stuff with data, like Stellar Networks or Starship Legends v2 (Legends v1 seems to have a much smaller resource footprint) - I don't have careful notes on specifically how I caused it in these cases, I just know that I satisfied myself these were causing issues and the problems were not happening without them.  (Regrettable, especially Stellar Networks - lots of useful data-handling in there.)

As a general rule, from what I've seen, exiting to the main menu to load a game seems to prevent the majority of incidents that would produce the memory leak warning while still maximizing the scope of potential mods to play with.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: How to remove memory leak detected message ?
« Reply #4 on: November 17, 2022, 07:39:47 PM »

The distinction here is that there are bounded and unbounded memory leaks. If e.g. a mod stores a reference to a campaign instance in a static member variable of a class somewhere, it's only ever going to leak at most one extra copy of the campaign; this is generally not great but - especially if you allocated extra ram - not a problem.

But if more than one copy is leaked - because several mods do this, for example, or because one mod ends up with a bunch of these - then the game may gradually become unstable as it runs out of memory. It's hard to say exactly when this will become a problem though. 2 copies? 3? 4? More than that? It just *depends*.
Logged

narf03

  • Lieutenant
  • **
  • Posts: 53
    • View Profile
Re: How to remove memory leak detected message ?
« Reply #5 on: November 18, 2022, 03:15:35 PM »

First of all, my english is no good, its not my first or secondary language. If i sounds like being a jerk, well it wasnt my intention, just im lack of vocabulary and proper skill of decorating my words.

I've mentioned seeing this memory leak error in several different mod threads and was told by multiple (fairly prominent) people that it didn't matter and I could just ignore it and keep playing.

My professional background is in software testing and the idea that one should "just ignore" a memory leak error popup sends me into a frothing rage. 

Either this advice is correct, which means the leak popup is a false positive and the conditions producing it should be carefully re-examined at the earliest possible moment, or the leak popup is correct and their advice is not correct and they should not be giving it and whatever code is producing the conditions that produce the popup REALLY needs to be looked at carefully.  I don't like either of those possibilities, because on both sides of the question it looks like there are fairily competent developers who - judging by results visible in the base game and in certain mods - should know what they're doing.

The conditions where I seem to consistently be able to produce this error usually involve one of the following sets of conditions:
1) playing with an absolutely extravagant mod like UAF, especially in conjunction with multiple other mods (my guess is the tourism fleets it provokes from all other factions contribute to multiplying the load fairly quickly)
2) playing with Nex + Vayra's Sector + a fair number (10-20ish) of other faction mods, starting a new game, and then loading a game while in the campaign rather than exiting to the menu and loading from there
3) playing with Nex + Apex + a fair number of other faction mods, starting a new game, and then loading a game while in the campaign rather than exiting to the menu and loading from there
4) playing with Nex + Idoneus, fighting (as Idoneus) a reasonably large battle (with control points) and then attempting to load any save game at all under any conditions - the only way to avoid this is to shut the application down and restart it, loading fresh
5) there are a smattering of other cases I've seen where large battles will set me up for a leak if I try loading afterward; it seems to be specific to certain factions, but I haven't been systematic about looking into those other cases yet
6) playing with mods that do a lot of stuff with data, like Stellar Networks or Starship Legends v2 (Legends v1 seems to have a much smaller resource footprint) - I don't have careful notes on specifically how I caused it in these cases, I just know that I satisfied myself these were causing issues and the problems were not happening without them.  (Regrettable, especially Stellar Networks - lots of useful data-handling in there.)

As a general rule, from what I've seen, exiting to the main menu to load a game seems to prevent the majority of incidents that would produce the memory leak warning while still maximizing the scope of potential mods to play with.


Partially agree, leak really have to depends on how much and how serious it is, to me memory leak is like water leaking in the house, if the amount of leak is so little, basically we can just ignore it, ie 10mB of ram wasted each load, with enough ram, the player can load once every minute and still able to last for hours.

Annoying the player not letting them a choice to ignore or suppress the per minute warning is just too much, warn them once or twice is enough, technically average players cant do anything about it, they had to accept the fact if it crash and accept the losses, they had been warned, and know whats the consequences.

Anyway, im not a software tester.

(More than likely it's an issue with one of the mods you're running. Though, always the possibility that some kind of leak snuck through in vanilla too, of course...)

But: if you open up data/config/settings.json, you can set "doRAMandVRAMChecksWhenRunningWithMods" and that should turn it off.
Had that flag set, getting much lesser warning, but it still exists, i guess its ok now, thanks.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: How to remove memory leak detected message ?
« Reply #6 on: November 18, 2022, 08:13:56 PM »

Erm, what I meant to say is that you should set this flag to "false" - sorry, just didn't type that part out for some reason :)
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: How to remove memory leak detected message ?
« Reply #7 on: November 19, 2022, 01:17:39 AM »

If you're using JRE8, then people will tell you to ignore it because the garbage collection will in all likelyhood handle it, it's just the game won't recognise that because it's designed for JRE7.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: How to remove memory leak detected message ?
« Reply #8 on: November 19, 2022, 08:19:00 AM »

If you're using JRE8, then people will tell you to ignore it because the garbage collection will in all likelyhood handle it, it's just the game won't recognise that because it's designed for JRE7.

From what I remember of the code, when it thinks there may be a leak it'll force a garbage collection round and then pop the message up if there's still more than one campaign copy in memory after the garbage collection has finished. I guess it's possible that in JRE8 forcing garbage collection somehow won't clear stuff reliably? Hmm.
Logged