Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 2 [3]

Author Topic: Quicker save/load? (Save bloat bug? -Alex)  (Read 7892 times)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Quicker save/load? (Save bloat bug? -Alex)
« Reply #30 on: June 26, 2019, 12:04:05 PM »

Thank you for chiming in! Any chance you could send me your save? And if you're feeling particularly generous, your mod folder as well? :)

Would probably have to upload those somewhere since I suspect the save would also be too large for an email attachment.
Logged

CynicJester

  • Ensign
  • *
  • Posts: 12
    • View Profile
Re: Quicker save/load? (Save bloat bug? -Alex)
« Reply #31 on: June 26, 2019, 12:39:49 PM »

Thank you for chiming in! Any chance you could send me your save? And if you're feeling particularly generous, your mod folder as well? :)

Would probably have to upload those somewhere since I suspect the save would also be too large for an email attachment.

https://drive.google.com/open?id=1g7YzdZTaFLwlZuEFVETZYUyrq2BHuoNf

https://drive.google.com/open?id=1gl7TI7W_mlzfdLqZpRvEwKe3P-F3aePQ

Try those and see if they work. I haven't actually used Google Drive for anything beyond sharing files with my phone, so it might make something blow up.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Quicker save/load? (Save bloat bug? -Alex)
« Reply #32 on: June 26, 2019, 02:35:40 PM »

Thank you so much!

Dug into this, and looks like it's VayraSector causing the issues. Turning it off should help, unless something else is *also* causing the same exact problem. Which, I mean, unlikely but possible.


Technical things below:
-----------------------------------------------------------------------------------------------
In a few of its classes there are things like:

private static final SectorAPI SECTOR = Global.getSector();
private static final SectorAPI sector = Global.getSector();

Because the variable is static, it means that the sector stored in that variable will remain the same when a savegame is reloaded, so it'll be pointing to the old sector. This is by itself a memory leak, though static fields don't get saved and so this would not affect the savefile directly.

However, what I think is happening is this old, no-longer-valid Sector is being referenced in these classes, and some references being saved in non-static fields. These fields *do* end up in the save file, and pull the rest of the old sector in with them.

Since the beforeGameSave() code only goes through the current sector - it has no knowledge of any old instances being kept around - the old sector's asteroids aren't cleaned up and end up in the save. Along with the rest of the sector in that save, so there's duplicates of everything. For example, searching for "chicomoztoc" in the save reveals two separate versions of the market - one "real", one from the invalid sector.

As far as fixing this: for the love of Ludd, don't put ANYTHING AT ALL (aside from primitives) into static variables unless you really know what you're doing. Ahem.
Logged

Vayra

  • Admiral
  • *****
  • Posts: 627
  • jangala delenda est
    • View Profile
Re: Quicker save/load? (Save bloat bug? -Alex)
« Reply #33 on: June 26, 2019, 03:04:40 PM »

Ah, miracles! Okay, I can fix that pretty easily then I imagine. Thanks! Expect a mod update later today.  ;D
Logged
Kadur Remnant: http://fractalsoftworks.com/forum/index.php?topic=6649
Vayra's Sector: http://fractalsoftworks.com/forum/index.php?topic=16058
Vayra's Ship Pack: http://fractalsoftworks.com/forum/index.php?topic=16059

im gonna push jangala into the sun i swear to god im gonna do it

Vocation

  • Ensign
  • *
  • Posts: 18
    • View Profile
Re: Quicker save/load? (Save bloat bug? -Alex)
« Reply #34 on: July 19, 2020, 12:41:24 AM »

I have the same issue as this. It starts when memory gets around 30% for me. I allocated 7.7gb to the game. I know because you can check it with console command mod.
Logged

Zephroze

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Quicker save/load? (Save bloat bug? -Alex)
« Reply #35 on: March 24, 2022, 11:33:21 PM »

Sorry for the necropost but considering this is already similar to my line of questioning and eliminates some potential bad actors in the code, I think it's the most appropriate place.

I too am having an issue but it's not save bloat. It's not memory bloat either as far as I know.

The longer I play the game within one session, the longer it takes to save the game. Within under an hour it can take up to 30 seconds to save the game, with it only getting worse the longer I play. Then I have to restart the game which takes a couple minutes. Pretty big mod list.

I've allocated 6gb of memory and I have 16gb total, but it's only using around 3.7gb at most before it starts chugging like this.

Any ideas what I can do? I can post saves and logs and such if somebody is willing to help. I'll also take suggestions on a mod manager that lets me change the load order, seeing as I'm pretty competent with managing mod lists if there's a tool that can do it.
Logged
Pages: 1 2 [3]