Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Save Game Compression + OutOfMemory causing save corruption?  (Read 6313 times)

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Save Game Compression + OutOfMemory causing save corruption?
« on: October 22, 2013, 02:13:29 AM »

Something I have noticed since turning save compression on by default in Exerelin is that I'm getting a lot of saves (sent in from other people) that when attempted to load say 'Premature end of file', and cannot be restored at all. Save files submitted from others before that I could load if I increased the memory limits on StarSector, and which could then be loaded successfully.

Pure conjecture from this point on :)

So, it seems to me that turning on save compression, combined with OutOfMemory errors (a problem with big mods/running many mods) or equivalent can result in a corrupt save. By leaving save compression off, the OutOfMemory problem seems to manifest on game load which, although annoying, can be rectified by increasing the memory constraints.

While having a smaller and faster loading file is good (and perhaps slightly less likely to hit an OutOfMemory error), I don't think it is worth the seemingly very real chance of causing corrupt saves.

Therefore, unless someone convinces me otherwise, I'm going to turn off save game compression by default in the next version of Exerelin and just see what happens. Load/save time is not really a concern and disk space is not a concern either. I would rather remove/limit the chance of unrecoverable saves.
Logged

Okim

  • Admiral
  • *****
  • Posts: 2161
    • View Profile
    • Okim`s Modelling stuff
Re: Save Game Compression + OutOfMemory causing save corruption?
« Reply #1 on: October 22, 2013, 05:43:32 AM »

How big is exactly your mod (systems, ships, scripts etc)? Cause i don`t get such problems in Ironclads (never got any out of memory issues with enabled save compression and modified vmparams).

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: Save Game Compression + OutOfMemory causing save corruption?
« Reply #2 on: October 22, 2013, 01:28:28 PM »

Well I don't actually have the issues. It is others who have not set their memory settings higher, or have only set them slightly higher and are playing a big game.

As for size of things:
Systems: 1 - 24
Stations: 5 - 35 per system
Fleets: 1 - 9 per station (usually about 5)
Factions: 0 - 8 additional factions (approx. new 12 ships each) can also be run with it

So, you can play a game with a lot of stuff :)

Without save compression, OutOfMemory errors are usually triggered on game load, which when memory is increased the save is playable again.

With save compression, it appears the OutOfMemory error can be triggered on game save, causing the save file to not be written correctly, which makes it unplayable. Although save compression may help memory use, it appears to give a chance of corrupt saves.
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Save Game Compression + OutOfMemory causing save corruption?
« Reply #3 on: October 22, 2013, 01:33:54 PM »

actually, you do Okim, i can't even play ironclads, my saves corrupt themselves after 10-20ish minutes of playing, even after all i did with memory allocation and 64-bit Java, it still wont run. :'(

Same goes for exerelin, the game works fine, but after i play too long, i have to restart because my comp is tanking frames and eventually the save corrupts itself.
Logged

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: Save Game Compression + OutOfMemory causing save corruption?
« Reply #4 on: October 22, 2013, 03:07:15 PM »

actually, you do Okim, i can't even play ironclads, my saves corrupt themselves after 10-20ish minutes of playing, even after all i did with memory allocation and 64-bit Java, it still wont run. :'(

Same goes for exerelin, the game works fine, but after i play too long, i have to restart because my comp is tanking frames and eventually the save corrupts itself.

If you like PM me your Exerelin save and I will have a look at it :)
Logged

Magician

  • Commander
  • ***
  • Posts: 156
    • View Profile
Re: Save Game Compression + OutOfMemory causing save corruption?
« Reply #5 on: October 22, 2013, 03:22:14 PM »

Its probably completely unsafe to do, but if you wanna try, you can do next:
- download latest  java jre, iirc java 7; rename your jre folder in Starsector folder and put there new jre. http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
- change a bit your vmparams:
Spoiler
java.exe -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -Djava.library.path=native\\windows -Xms512m -Xmx1024m -classpath janino.jar;commons-compiler.jar;commons-compiler-jdk.jar;starfarer.api.jar;starfarer_obf.jar;jogg-0.0.7.jar;jorbis-0.0.15.jar;json.jar;lwjgl.jar;jinput.jar;log4j-1.2.9.jar;lwjgl_util.jar;fs.sound_obf.jar;fs.common_obf.jar;xstream-1.4.2.jar -Dcom.fs.starfarer.settings.paths.saves=..\\saves -Dcom.fs.starfarer.settings.paths.screenshots=..\\screenshots -Dcom.fs.starfarer.settings.paths.mods=..\\mods -Dcom.fs.starfarer.settings.paths.logs=. com.fs.starfarer.StarfarerLauncher
[close]
Also I am using 32-bit system.
Same goes with Exerelin. I did quick testrun with 24 systems, 3 planets, 5 stations and almost every compatible faction. So far, though overall it took maybe hour, I only experienced a little bit of stuttering. But saves were ok and I didn't experience any errors while extensively using hyperspace, combat and save/load.
I yet can't tell if using java or changes in vmparams improved my situation, but if you don't have anything to lose..
In my case my game behaved Ok while in one system, but I started to experience errors or degrading game performance in form of increasing stuttering as soon as I stepped outside of home system and extensively used hyperspace to visit places.
« Last Edit: October 22, 2013, 03:24:49 PM by Magician »
Logged