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: Codex Overhaul (05/11/24)

Author Topic: save data excessive ram usage  (Read 338 times)

Chefsector

  • Ensign
  • *
  • Posts: 6
    • View Profile
save data excessive ram usage
« on: May 05, 2024, 04:44:13 AM »

Hello there,

I have a problem, when saving after a certain amount of time has elapsed save time increases dramaticly from 2 second normally to up to 30 seconds while this happens certain starsector assets shake from left to right (when saving on the campaign map).

When this happens memory usage spikes to 100% of allocated RAM (6GB).

This happens on vanilla and seemingly seems to worsen when used in conjuction with mods.

As far as I could see this problem traces back a couple of years on the forum, my question now is, is this just something that should be accepted or is there a solution i've missed?

Some more context:
- 4k screen (3840 by 2160)
- 32gb of total RAM (6GB allocated)
- No spikes to 100% on CPU and GPU usage while saving (or any abnormal spikes in usage for that matter)
- Data saved to SSD
« Last Edit: May 05, 2024, 04:45:49 AM by Chefsector »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24270
    • View Profile
Re: save data excessive ram usage
« Reply #1 on: May 05, 2024, 08:32:43 AM »

(Moving this to modded because of the increased ram allocation as a baseline.)

The screen shake is a completely unrelated issue, and is fixed for the next release.

Are you *sure* you're seeing 30 second save times in vanilla? What's a "certain time" - I could see this happening, say, if the game is left to idle for 12 hours or something; it seems like the OS does some funny things sometimes if that happens. But not under normal circumstances; I'm not aware of anything like this in vanilla.

Re: memory usage spikes - how are you measuring this? Task manager is unreliable and basically useless for measuring Java memory use; it's unfortunately just going to produce near-meaningless results.

That said, saving does increase the memory use by some significant amount; nowhere near 6gb in vanilla, though - for vanilla, the standard vanilla allocation of 1.5gb should be a completely fine. (But, again, you might see 6gb in task manager, and that wouldn't mean the game was actually using all of it. And if you allocate more, it might use more than it would if you didn't; it's just not the most straightforward thing.)

And with all of *that* said, you could give this a shot:
https://fractalsoftworks.com/forum/index.php?topic=29320.0
Logged

Chefsector

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: save data excessive ram usage
« Reply #2 on: May 05, 2024, 09:01:25 AM »

- A certain time would be from around 1/2 hours onwards.
- Yes I used task manager.
- Maybe 30 seconds is a bit of an overstatement but it does go to the 10-15 second range after saving normally for a while.
- Never leave the game idling since I always close it off when I'm done, it always happens during 'normal' active playing.
- Was playing today with 1 save per 90 minutes (heavily modded tho), problem seems not to repeat so perhaps that saving itself creates the issue? Saving does return to normal after opening and closing the application but yeah not my favourite solution.

Anyway thank you for the timely reply and providing a possible solution, will try it.


Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24270
    • View Profile
Re: save data excessive ram usage
« Reply #3 on: May 05, 2024, 09:10:53 AM »

Thank you for the info!

- Was playing today with 1 save per 90 minutes (heavily modded tho), problem seems not to repeat so perhaps that saving itself creates the issue? Saving does return to normal after opening and closing the application but yeah not my favourite solution.

That kind of makes sense, yeah - for the types of memory leaks it's easy to accidentally create, they tend to leak an extra copy of the campaign, basically keeping the old copy around when a new copy is created when a new game is loaded. But if you don't *do* that, then it won't happen. So in that scenario, the trigger would be loading rather than saving.

Not aware of this kind of leak in vanilla, though (doesn't mean it's impossible, of course - but I'd expect it to be pretty uncommon to have slipped under the radar for so long). And if it's triggered purely by saving, then it's something else. Hopefully the java 23 switch will sort it out for you!
Logged

Chefsector

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: save data excessive ram usage
« Reply #4 on: May 06, 2024, 12:35:00 PM »

Will be fine, it just was very noticable after playing non-stop for a couple of days. Lovely game.

Looking forward to the version switch!

Thank you for the info!

- Was playing today with 1 save per 90 minutes (heavily modded tho), problem seems not to repeat so perhaps that saving itself creates the issue? Saving does return to normal after opening and closing the application but yeah not my favourite solution.

That kind of makes sense, yeah - for the types of memory leaks it's easy to accidentally create, they tend to leak an extra copy of the campaign, basically keeping the old copy around when a new copy is created when a new game is loaded. But if you don't *do* that, then it won't happen. So in that scenario, the trigger would be loading rather than saving.

Not aware of this kind of leak in vanilla, though (doesn't mean it's impossible, of course - but I'd expect it to be pretty uncommon to have slipped under the radar for so long). And if it's triggered purely by saving, then it's something else. Hopefully the java 23 switch will sort it out for you!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24270
    • View Profile
Re: save data excessive ram usage
« Reply #5 on: May 06, 2024, 02:12:13 PM »

Thank you, and thank you for understanding!

(If you do try java 23, I'd appreciate it if you could let me know if it helped or not. No worries about doing it just to let me know, though.)
Logged

Chefsector

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: save data excessive ram usage
« Reply #6 on: May 07, 2024, 01:45:39 AM »

Yes I have installed it, I will play with mikohime on for a while and give you an update in a couple of days.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24270
    • View Profile
Re: save data excessive ram usage
« Reply #7 on: May 07, 2024, 08:51:06 AM »

Great, thank you!
Logged

Chefsector

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: save data excessive ram usage
« Reply #8 on: May 10, 2024, 10:56:24 AM »

Hello Alex,

I have played with it for a couple of days and the saving issue was resolved completely, game also seems to run a little smoother overal, thank you for the suggestion. In my eyes experience switching to java 23 was positive with no other issues popping up :)

Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24270
    • View Profile
Re: save data excessive ram usage
« Reply #9 on: May 10, 2024, 08:52:06 PM »

Awesome, thank you for confirming! Hopefully with the next release for Starsector (which includes an upgrade to Java 17) the experience will be smooth out of the box.
Logged

Chefsector

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: save data excessive ram usage
« Reply #10 on: May 11, 2024, 04:40:13 AM »

Ah that's awesome, as far as I understood starsector is still on java 7, must be an 'exciting' task to update after a decade long development journey.

Looking forward to the next update already!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24270
    • View Profile
Re: save data excessive ram usage
« Reply #11 on: May 11, 2024, 08:51:07 AM »

It's already done in the dev version! Wasn't too bad, thanks to Miko's (the person that made the conversion kit for 23) help and advice :) But yeah, it was definitely something I was dreading a bit.
Logged