Persistence Test. Reduce save bloat

Post » Sun May 26, 2013 11:56 pm

I was concerned about what happened when I uninstalled a mod, and did not see any definitive information on garbage collection for mod removal. So I created a quick mod. to test this very thing.

What it amounts to is this. The test does the following:

  • mod creates persistent data. A string array, each element unique to ensure no shallow copies.
  • test uninstall, just stopping the quest.
  • test uninstall, stopping quest. Setting array to 'none'.
  • test uninstall, stopping the quest, removing mod (deactive esp).
  • test uninstall, stopping quest. Setting array to new string[1].

Conclusion:

  • best cleanup: set all arrays to 'none'. This seems to work, but produces errors in the log.
  • 2nd best: set all arrays to length of 1. No errors, but save file size does reduce.

If I am missing an obvious way to get the game to garbage collect, please let me know. I can attach the mod. if anyone wants to confirm or further test. I cannot see a way to attach to this message though....

File sizes:

Original save.  No mod.-rwx------+ 1 Administrators None 3036827 May 26 09:27 Save 6 - persistTest  Editor Smoke Test Cell  00.00.46.ess-rwx------+ 1 Administrators None    1736 May 26 09:27 Save 6 - persistTest  Editor Smoke Test Cell  00.00.46.skseKeep garbage saves.  Before/after-rwx------+ 1 Administrators None 3051652 May 26 10:19 Save 7 - persistTest  Editor Smoke Test Cell  00.00.52.ess-rwx------+ 1 Administrators None    1819 May 26 10:19 Save 7 - persistTest  Editor Smoke Test Cell  00.00.52.skse-rwx------+ 1 Administrators None 3051950 May 26 10:19 Save 8 - persistTest  Editor Smoke Test Cell  00.01.04.ess-rwx------+ 1 Administrators None    1819 May 26 10:19 Save 8 - persistTest  Editor Smoke Test Cell  00.01.04.skseRemove garbage saves.  Before/after-rwx------+ 1 Administrators None 3051449 May 26 10:20 Save 9 - persistTest  Editor Smoke Test Cell  00.00.54.ess-rwx------+ 1 Administrators None    1819 May 26 10:20 Save 9 - persistTest  Editor Smoke Test Cell  00.00.54.skse-rwx------+ 1 Administrators None 3037894 May 26 10:21 Save 10 - persistTest  Editor Smoke Test Cell  00.01.09.ess-rwx------+ 1 Administrators None    1819 May 26 10:21 Save 10 - persistTest  Editor Smoke Test Cell  00.01.09.skseKeep garbage saves.  Before/after.  'Save 13' is save after mod. esp set inactive.-rwx------+ 1 Administrators None 3037894 May 26 10:21 Save 10 - persistTest  Editor Smoke Test Cell  00.01.09.ess-rwx------+ 1 Administrators None    1819 May 26 10:21 Save 10 - persistTest  Editor Smoke Test Cell  00.01.09.skse-rwx------+ 1 Administrators None 3051562 May 26 10:45 Save 11 - persistTest  Editor Smoke Test Cell  00.01.05.ess-rwx------+ 1 Administrators None    1819 May 26 10:45 Save 11 - persistTest  Editor Smoke Test Cell  00.01.05.skse-rwx------+ 1 Administrators None 3052345 May 26 10:46 Save 12 - persistTest  Editor Smoke Test Cell  00.01.22.ess-rwx------+ 1 Administrators None    1819 May 26 10:46 Save 12 - persistTest  Editor Smoke Test Cell  00.01.22.skse-rwx------+ 1 Administrators None 3053200 May 26 10:46 Save 13 - persistTest  Editor Smoke Test Cell  00.01.29.ess-rwx------+ 1 Administrators None    1736 May 26 10:46 Save 13 - persistTest  Editor Smoke Test Cell  00.01.29.skseReinit saves.  Before/after-rwx------+ 1 Administrators None 3051372 May 26 11:00 Save 14 - persistTest  Editor Smoke Test Cell  00.00.52.ess-rwx------+ 1 Administrators None    1819 May 26 11:00 Save 14 - persistTest  Editor Smoke Test Cell  00.00.52.skse-rwx------+ 1 Administrators None 3039744 May 26 11:00 Save 15 - persistTest  Editor Smoke Test Cell  00.01.07.ess-rwx------+ 1 Administrators None    1819 May 26 11:00 Save 15 - persistTest  Editor Smoke Test Cell  00.01.07.skse

Log when setting array to 'none':

[05/26/2013 - 10:20:34AM] Papyrus log opened (PC)[05/26/2013 - 10:20:34AM] Update budget: 1.200000ms (Extra tasklet budget: 1.200000ms, Load screen budget: 500.000000ms)[05/26/2013 - 10:20:34AM] Memory page: 128 (min) 512 (max) 76800 (max total)[05/26/2013 - 10:20:42AM] warning: Property pTG05KarliahInvisibilitySpell on script QF_TG05_00021551 attached to TG05 (00021551) cannot be initialized because the script no longer contains that property[05/26/2013 - 10:20:42AM] warning: Property TG05KarliahInvisibilitySpell on script tg06questscript attached to TG06 (00021552) cannot be initialized because the script no longer contains that property[05/26/2013 - 10:20:42AM] VM is freezing...[05/26/2013 - 10:20:42AM] VM is frozen[05/26/2013 - 10:20:43AM] Reverting game...[05/26/2013 - 10:20:44AM] warning: Property pTG05KarliahInvisibilitySpell on script QF_TG05_00021551 attached to TG05 (00021551) cannot be initialized because the script no longer contains that property[05/26/2013 - 10:20:44AM] warning: Property TG05KarliahInvisibilitySpell on script tg06questscript attached to TG06 (00021552) cannot be initialized because the script no longer contains that property[05/26/2013 - 10:20:46AM] Loading game...[05/26/2013 - 10:20:47AM] VM is thawing...[05/26/2013 - 10:20:47AM] [kvPersistenceTestConfig ] INITIALIZED[05/26/2013 - 10:20:47AM] OnInit:  Calling Maintenance...[05/26/2013 - 10:20:47AM] Maintenance:[05/26/2013 - 10:20:47AM] Mod added.  12306 characters added to save data.-- STAGE 1 ---------------------------1.  Make a new save game.  Now.2.  Use MCM Mod Config.  Keep Garbage.3.  Make another save.4.  Exit & Restart game.  Reload game used prior to (1)-- STAGE 2---------------------------1.  Make a new save game.  Now.2.  Use MCM Mod Config.  Remove Garbage.3.  Exit game.  Check save file sizes.[05/26/2013 - 10:20:47AM]  version: 1.010000[05/26/2013 - 10:20:48AM] InitWidgetLoader()[05/26/2013 - 10:20:52AM] VM is freezing...[05/26/2013 - 10:20:52AM] VM is frozen[05/26/2013 - 10:20:53AM] Saving game...[05/26/2013 - 10:20:53AM] VM is thawing...[05/26/2013 - 10:20:59AM] _removeGarbage start[05/26/2013 - 10:20:59AM] Error: Cannot cast from None to String[]stack:	[kvPersist (040012C4)].kvpersistencetest._removeGarbage() - "kvPersistenceTest.psc" Line 16	[kvConfig (040012C5)].kvPersistenceTestConfig.OnOptionSelect() - "kvPersistenceTestConfig.psc" Line 41	[kvConfig (040012C5)].kvPersistenceTestConfig.SelectOption() - "ski_configbase.psc" Line 1065	[SKI_ConfigManagerInstance (02000802)].SKI_ConfigManager.OnOptionSelect() - "ski_configmanager.psc" Line 140[05/26/2013 - 10:20:59AM] Quest was running: TRUE  Now running: False[05/26/2013 - 10:20:59AM] Now SAVE the game.  Size should be reduced from previous[05/26/2013 - 10:20:59AM] _removeGarbage done[05/26/2013 - 10:21:07AM] VM is freezing...[05/26/2013 - 10:21:07AM] VM is frozen[05/26/2013 - 10:21:07AM] Saving game...[05/26/2013 - 10:21:07AM] VM is thawing...[05/26/2013 - 10:21:11AM] VM is freezing...[05/26/2013 - 10:21:11AM] VM is frozen[05/26/2013 - 10:21:12AM] Log closed
User avatar
Nathan Maughan
 
Posts: 3405
Joined: Sun Jun 10, 2007 11:24 pm

Post » Sun May 26, 2013 10:25 pm

Be careful with setting variables to "None". I had an issue this. I had a reset function that would set some arrays to "None," and then reinitialize these arrays. But if the user saved during the function call, when the user would load that save, the papyrus would think the function was changed and instantly flush whatever was on the stack. So my function would not finish. It only happened when the function was started by a thread that originated from an SKSE event, as it would continue fine otherwise. But I didn't do any testing to confirm this, so I'm not sure if it's an SKSE bug or something else I haven't realized.

I don't ever set variables to "None" anymore because of all the potential errors.

User avatar
SWagg KId
 
Posts: 3488
Joined: Sat Nov 17, 2007 8:26 am


Return to V - Skyrim

cron