Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Memory leak on Linux? [0.95.1a]  (Read 305 times)

derdelz

  • Ensign
  • *
  • Posts: 2
    • View Profile
Memory leak on Linux? [0.95.1a]
« on: February 02, 2023, 02:56:36 PM »

I finally managed to play Starsector again this year but I noticed relatively frequent slowdowns sometimes followed by a crash of the game. This was never based on a specific action e.g. it happened when taking a shuttle to the bar or during a fight.

Today I had by chance my system monitor open when I noticed the slowdown and I saw that my memory was maxed out, which also seemed to cause all my cores to run at almost 100%. Closing Starsector cleared 22 GB of memory.

OS: Ubuntu 22.04
Starsector 0.95.1a

I will keep an eye on my memory usage while I play to see if this happens consistently.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Memory leak on Linux? [0.95.1a]
« Reply #1 on: February 02, 2023, 03:06:16 PM »

Hi - is this vanilla, or with mods? It seems virtually impossible for Starsector to use that much memory in vanilla; the upper limit should be 1.5 gigs.
Logged

derdelz

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Memory leak on Linux? [0.95.1a]
« Reply #2 on: February 03, 2023, 01:39:35 AM »

It's vanilla.

I had only one more crash yesterday but without a significant memory increase.
The logs don't show any errors before the crash, is there a debug flag or something that enables more detailed logs?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Memory leak on Linux? [0.95.1a]
« Reply #3 on: February 03, 2023, 09:01:37 AM »

Hmm, how strange! Is there an hs_err_pidXXXX.log file somewhere in the starsector folder, where the X's are a bunch of numbers? That should be generated if the game crashes in some specific ways. If that's present, seeing the contents might help point us in the right direction.

(I'm not sure if there's a Linux equivalent, but on Windows, I'd suggest looking at the Event Viewer to check for any errors around the time of the crash; that can also provide useful information.)
Logged

eamax

  • Ensign
  • *
  • Posts: 28
    • View Profile
Re: Memory leak on Linux? [0.95.1a]
« Reply #4 on: February 03, 2023, 04:32:47 PM »

The only thing that fixed problems like this for me, with or without mods, was changing the JRE version as stated here:
It's caused by using mods in general, regardless of your PC specs.
The only known fix is switching to JRE 8.

Copy/pasting from Discord, sorry if formatting is bad:


Mini-guide: Switching to Java 8 to prevent the post-battle slowdown
Not officially supported, may cause unrelated issues, do at your own risk and please report back if you do notice it causing problems.

Symptoms
- After some time playing and immediately after a battle, the game FPS will plummet (eg from 60 to 15-25) and usually only go back to normal after a game restart.
- Saving/loading takes 5x longer than usual.
- Using at least one mod (that adds new sprites? incl. GraphicsLib).

Fix (slow down and read this part carefully)
1. Go to your starsector install and rename the jre folder to jre7.
2. Download either of the following (both are the same JRE 8 v271) (Mac/Linux users look below for download link):
    - (72 MB .zip) https://drive.google.com/file/d/1CGRtnv5hIGCtcdlvZXFO0F58VXqYUo6x/view?usp=sharing
    - (48 MB .7z) https://drive.google.com/file/d/155Lk0ml9AUGp5NwtTZGpdu7e7Ehdyeth/view?usp=sharing
3. Extract that into your game folder so you have a folder named jre. You'll now have both jre (with java 8 ) and jre7.
4. Make sure that your starsector/starsector-core/data/config/settings.json allowAnyJavaVersion is set to true. Then launch the game as normal.


Potential issues
- Game+launcher is zoomed in/off-center.
    Fix: Right-click Starsector, Properties, Compatibility, Change high DPI settings, tick checkbox for "Override...Scaling performed by Application"
    Thanks to Normal Dude for the fix.
Logged