Jump to content

[1.0][Release-5-0][April 28, 2015] Active Texture Management - Save RAM!


rbray89
 Share

Recommended Posts

GC means "Garbage Collector". In C# (and other garbage-collected languages), when a memory allocation is triggered and there's not enough memory, the garbage collector will scan through all objects, marking any that are no longer referenced. At the end, all marked allocations are freed and then new allocations can continue. The GC is responsible for all the little glips and blips and stutters that occur in KSP -- each one of those is a fraction-of-a-second pause while the GC cleans things up.

Correct, and my thought process was that because of the upper memory limit on 32 bit processes, the memory that is available for released objects is less. Therefore the GC needs to run more often to keep the memory space clear for allocation. Less application memory usage should mean the GC has more room for itself to work with. NOTE: That all my GC experience is mainly with java so it may not be correct with C#.

Link to comment
Share on other sites

GC means "Garbage Collector". In C# (and other garbage-collected languages), when a memory allocation is triggered and there's not enough memory, the garbage collector will scan through all objects, marking any that are no longer referenced. At the end, all marked allocations are freed and then new allocations can continue. The GC is responsible for all the little glips and blips and stutters that occur in KSP -- each one of those is a fraction-of-a-second pause while the GC cleans things up.

Yes, GC is kind of slow... That's why many games even written in C# or other managed languages still implement their own memory management, just like the old C/C++ way...

Link to comment
Share on other sites

Wow! Good job! I got one heck of a performance boost. Went back to full rez at 8x AA and still no slowdown. Still pushing 2,918,124KB though.

KCzzT1r.png

Correct, and my thought process was that because of the upper memory limit on 32 bit processes, the memory that is available for released objects is less. Therefore the GC needs to run more often to keep the memory space clear for allocation. Less application memory usage should mean the GC has more room for itself to work with. NOTE: That all my GC experience is mainly with java so it may not be correct with C#.

C# isn't too far different from J+, both share similarities to C++ being the first major object orientated programming language. God bless Bjarne Stroustrup!

Edited by Eskandare
Link to comment
Share on other sites

After installing this mod my game freezes in the loading screen with the following error message:

[LOG 12:03:50.931] AssemblyLoader: Loading assembly 'KSP'
[EXC 12:03:51.202] UnauthorizedAccessException: Access to the path "D:\Games\Squad\Kerbal Space Program 0.22\GameData\RemoteTech2\RemoteTech_Settings.cfg" is denied.

Without the DLL it's loading normal.

Nevermind, after deleting the cfg-file its also running with the texture compressor.

Edited by NicoH
Link to comment
Share on other sites

The game has to be able to load in the first place unfortunately, I can't compress the textures as they are loading.

Now this is an interesting implication. Does this mean we are still limited to adding about 3.5MB worth of mods to the game?

I still got the game randomly closing though as I landed a plane, same as before, but it's only happened once so far.

Link to comment
Share on other sites

Now this is an interesting implication. Does this mean we are still limited to adding about 3.5MB worth of mods to the game?

I would say yes. The game loads all the main components in first, and then post-initial load goes through to compress offending textures down. Though the textures themselves aren't permanently compressed. If you push the limit, you're likely okay as really it just cleans space up for actually doing things.

Link to comment
Share on other sites

Does this mean we are still limited to adding about 3.5MB worth of mods to the game?

Mods aren't the only memory consumption in the game. So in the past the number of mods that would later lead to crashes in the game could now be accommodated by having them compressed at load and then leaving more free space for the game to do its thing.

Link to comment
Share on other sites

The game has to be able to load in the first place unfortunately, I can't compress the textures as they are loading.
Now this is an interesting implication. Does this mean we are still limited to adding about 3.5MB worth of mods to the game?

I still got the game randomly closing though as I landed a plane, same as before, but it's only happened once so far.

At what point during game loading does the plugin kick in and do its thing (after parts loading, before main menu)? Would it be possible to write a plugin that intercepts the parts loading and then would be able load parts and compress textures as they are loaded?

Link to comment
Share on other sites

Yep you must stay under 3,5 GB at load up.

I tried it.

When the general game startup goes over 3,5 the game crashes.

But hmm hmm I guess that is a thing we can life with.

this is not Skyrim..... (But would be cool ) where you can add 100 mods ...

Link to comment
Share on other sites

At what point during game loading does the plugin kick in and do its thing (after parts loading, before main menu)? Would it be possible to write a plugin that intercepts the parts loading and then would be able load parts and compress textures as they are loaded?

Watching my commit size for ram usage on task manager, I can tell you that it performs the compression action right after the main loading splash, during the momentary black screen before the main menu appears. The part that has 'loading' in the lower right corner is the moment it does the compression.

Link to comment
Share on other sites

This is an incredible and must have addition to the game. Even were I not running a ton of mods, I would want to have this with a pure stock setup. Either this or something like it should be implemented into the game directly.

Link to comment
Share on other sites

Such a simple little mod, but great results. This sort of thing should not have to be modded in. ;)

A few percent in memory reduction in my case, but for those who like to use lots of poorly textured part mods, this is excellent!

Link to comment
Share on other sites

Because this is a dll file, it will not work on Linux. Are you able to compile an .so file of your source code, so it might be run on the Linux version too? Maybe also an 32 and a 64 bit version, because the Linux version of KSP comes with both excecutables.

Link to comment
Share on other sites

Because this is a dll file, it will not work on Linux. Are you able to compile an .so file of your source code, so it might be run on the Linux version too? Maybe also an 32 and a 64 bit version, because the Linux version of KSP comes with both executables.

Its work fine with 64bit Linux, as others plugins dlls. Just try it, and you will see.

BTW, thanks for this mod. I use a lot of graphic heavy mods and I newer have memory related problems with KSP due using 64bit build with "disable wrong libpng" patch, but I got some performance gain and scene loading speedup. Nice work, thanks again.

Another thing what Im waiting is png2mbm converter, sister of mbm2png, lol. Thats because I read before about slow and memory hungry png unpacking in Unity. So I wish to do some tests with pure mbm textures for all. Disk space usage and texture loading times not a problem for me due big and fast SSD.

Link to comment
Share on other sites

Its work fine with 64bit Linux, as others plugins dlls. Just try it, and you will see.

BTW, thanks for this mod. I use a lot of graphic heavy mods and I newer have memory related problems with KSP due using 64bit build with "disable wrong libpng" patch, but I got some performance gain and scene loading speedup. Nice work, thanks again.

Another thing what Im waiting is png2mbm converter, sister of mbm2png, lol. Thats because I read before about slow and memory hungry png unpacking in Unity. So I wish to do some tests with pure mbm textures for all. Disk space usage and texture loading times not a problem for me due big and fast SSD.

The png conversion isn't memory hungry, it's just slow.

Link to comment
Share on other sites

Because this is a dll file, it will not work on Linux. Are you able to compile an .so file of your source code, so it might be run on the Linux version too? Maybe also an 32 and a 64 bit version, because the Linux version of KSP comes with both excecutables.

As Optimus22Prime said it will work. KSP and its mod runs on mono and the dll are not native windows code but mono pseudo code.

Link to comment
Share on other sites

I have always had issues with my addiction to mods but after using this mod I'm at 2.7gb from 3.4gb AND able to use Krags planet factory with B9 NP KW Interstellar KSPX KOSMOS proc fairings and wings FAR Kethane Joint reinforcement LTech Deadly Reentry Remote Tech station science LLL Infernal robotics Mech Jeb ALCOR RLA and more ! I also used the quarter res KOSMOS KW reduction and squad reduction but this is incredible!

The biggest gains were in KragsPlanetFactory where I cut my RAM Usage by 350mb in that mod alone!

Link to comment
Share on other sites

I have always had issues with my addiction to mods but after using this mod I'm at 2.7gb from 3.4gb AND able to use Krags planet factory with B9 NP KW Interstellar KSPX KOSMOS proc fairings and wings FAR Kethane Joint reinforcement LTech Deadly Reentry Remote Tech station science LLL Infernal robotics Mech Jeb ALCOR RLA and more ! I also used the quarter res KOSMOS KW reduction and squad reduction but this is incredible!

The biggest gains were in KragsPlanetFactory where I cut my RAM Usage by 350mb in that mod alone!

Glad it was able to help!

Link to comment
Share on other sites

rbray89, you must be sick and tired of praises from everybody using this mod...

but, I'm sorry, I can't help it.

Thank you for making this mod!!! It's great. Just to state some of the more memory-hungry mods, I am using B9 Aerospace, NovaPunch2, Universe Replacer, City Lights and Clouds Plugin, and Lack Luster Labs. I go up to about 3.5 Gigabytes and then run at 2.7. That's a saving of 800 Megabytes!

Edited by Andrew Hansen
Link to comment
Share on other sites

Its work fine with 64bit Linux, as others plugins dlls. Just try it, and you will see.

Interesting, then I see no difference, I use the 64 bit version too and my VRAM wents still full till 98% (of 2048 MB) and the system ram is also very high. And I can't see any performance boost in any, that was the only reason I wanted to try this.

But I will give it a second shot and try to see if there will something change if I use it or not.

Link to comment
Share on other sites

together with b9-extreme-texture-reduction, the novapunch2-extreme-texture-reduction and 1/8 res I have around 1.5Gb RAM savings! (only disadvantage: it does load slower)

Edited by ExtremeTrader
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...