Jump to content

[1.9.x-1.12.x] HeapPadder - Pads the heap to minimize the garbage collection


linuxgurugamer

Recommended Posts

Thanks for doing this! Just to be clear, I don't have to hit any combination of buttons to activate the heap padding (alt-end), it just works? 

 

Woops. Should have read previous posts. 

 

Thanks again!

Edited by Crixomix
Link to comment
Share on other sites

  • 3 months later...

So I have 64 gigs of ram... The current maximum number (for 32 gigs)  is too small.

The last number (total    : 8192) -- I can just change to say 24 gigs (24576) ? Would that work? 
If not, how do I change the cfg to account for my extra memory ?

Edited by Francois424
Link to comment
Share on other sites

23 hours ago, Francois424 said:

So I have 64 gigs of ram... The current maximum number (for 32 gigs)  is too small.

The last number (total    : 8192) -- I can just change to say 24 gigs (24576) ? Would that work? 
If not, how do I change the cfg to account for my extra memory ?

Yes, but you really don't need to. I also have 64 gig, and I don't bother to change anything in the files

Link to comment
Share on other sites

1 hour ago, linuxgurugamer said:

Yes, but you really don't need to. I also have 64 gig, and I don't bother to change anything in the files

Alright, thanks.  I did notice a nice improvement.
There's the odd pause (probably assigning more memory or purging some) which is a bit longer than usual, but far less frequent.
How I missed this mod for so long is a mystery.  Thanks for making it.

Link to comment
Share on other sites

  • 2 months later...
58 minutes ago, Crixomix said:

I saw that they mentioned in the latest patch that garbage collection is improved/fixed. Does that mean heap padder is no longer necessary to prevent stuttering? Or is this still a necessary mod?

Thanks,

 

GC handling has improved enormously in 1.8. I run around 130 mods and I no longer need to pad the heap.

Link to comment
Share on other sites

Hi  Linuxgurugamer,

I was wondering if your mod could be ported to other unity game that also suffer from garbage collection stutter.

I dont play KBS but im looking for a way to play Pathfinder Kingmaker, pillar of eternity and tower of time  without those periodic stutter every minute or so, I know for a fact that they are cause by garbage collection, when I hack the code and add garbage call myself this delay the stutter.

If I could use your mod to delay the time between those stutter and then I could call gb.collect when i loot something and never see those stutter again and enjoy the game (im extremely sensitive to stutter like that)

Would It be possible, would it take a lot of effort to make the mod work on other game ? 

 but want do you think, It would be great to use your mod on other unity game and make them a lot more enjoyable.

 

 

Link to comment
Share on other sites

1 hour ago, truthseeker said:

Hi  Linuxgurugamer,

I was wondering if your mod could be ported to other unity game that also suffer from garbage collection stutter.

I dont play KBS but im looking for a way to play Pathfinder Kingmaker, pillar of eternity and tower of time  without those periodic stutter every minute or so, I know for a fact that they are cause by garbage collection, when I hack the code and add garbage call myself this delay the stutter.

If I could use your mod to delay the time between those stutter and then I could call gb.collect when i loot something and never see those stutter again and enjoy the game (im extremely sensitive to stutter like that)

Would It be possible, would it take a lot of effort to make the mod work on other game ? 

 but want do you think, It would be great to use your mod on other unity game and make them a lot more enjoyable.

It is mostly generic code, so you shouldn't have any problem to port it over.  License allows it as well, but if you were asking, then you have my permission to go ahead, just let us know how it goes.

Link to comment
Share on other sites

Well to be fair my programmer skills are pretty low, I use to program in college so its been a while.

Ive been looking for a solution for a long time to fix those stutters with no succes. those games I really want to play and if the heappadder make the game more playable then im willing to try .

After looking up the heappadder code i think I could do it with a bit of direction from you if you are willing to help a bit :).

First I dont get where do you start the program where is it  called and initialized  and there is this line of code that I have no clue what it does and how is it related to the game itself :[KSPAddon(KSPAddon.Startup.MainMenu, true)] .

What is this line doing it seems to be connected to the game code and how do you connect to the game startup.

Another question is how much time you can gain with the heappadder in between  stutters ? if my game stutter every minute how much can i gain from it ?

I dont want to annoyed you with that, I hope you dont mind helping a bit :)

 

 

 

Link to comment
Share on other sites

14 hours ago, truthseeker said:

Well to be fair my programmer skills are pretty low, I use to program in college so its been a while.

Ive been looking for a solution for a long time to fix those stutters with no succes. those games I really want to play and if the heappadder make the game more playable then im willing to try .

After looking up the heappadder code i think I could do it with a bit of direction from you if you are willing to help a bit :).

First I dont get where do you start the program where is it  called and initialized  and there is this line of code that I have no clue what it does and how is it related to the game itself :[KSPAddon(KSPAddon.Startup.MainMenu, true)] .

What is this line doing it seems to be connected to the game code and how do you connect to the game startup.

Another question is how much time you can gain with the heappadder in between  stutters ? if my game stutter every minute how much can i gain from it ?

I dont want to annoyed you with that, I hope you dont mind helping a bit :)

Not annoying, but not much I can do.

It's a Unity module, using the standard Unity MonoBehaviour to be run.

The line:

[KSPAddon(KSPAddon.Startup.MainMenu, true)]

Is specific to KSP, saying that it should start at the MainMenu, and to only run once.  It should come out and whatever in the other game is used to start a MonoBehaviour module should be used.  I have no idea what that may be

Link to comment
Share on other sites

On 2/12/2020 at 8:00 AM, linuxgurugamer said:

Not annoying, but not much I can do.

It's a Unity module, using the standard Unity MonoBehaviour to be run.

The line:


[KSPAddon(KSPAddon.Startup.MainMenu, true)]

Is specific to KSP, saying that it should start at the MainMenu, and to only run once.  It should come out and whatever in the other game is used to start a MonoBehaviour module should be used.  I have no idea what that may be

 Do I understand this correctly:

You use miniavc.dll which is a plugin specific to KPS( KSP-AVC Add-on Version Checker Plugin 1.1.6.2 - MiniAVC ) you can find online to connect with the game.

 The line [KSPAddon(KSPAddon.Startup.Instantly, false)]  tell the plugin to call your function at a specific moment which is specified in the parameter KSPAddon.Startup.Instantly which I presume is at the start of the game.

- The second  parameter is a boolean ,  in this case the parameter is false , what does this parameter do?

 with KIngmaker pathfinder I can use  unity mod manager,  the equivalent of miniavc.dll plugin . The tool got a function that is onMonoUpdate I was thinking to maybe use it to increase the heap.

- Do i have to run the padHeap.cs code at the start of the game to make it works?  for example if i connect it with a button that i press and run it once I press it, would it work ? (I know its not optimal but I will see my options as I go along and get familiar with the tool)  or do I need to increase the heap at a specific moment for it to work and stay like that ?

- And one last thing how much improvement should I expect with 16 gig in my system if garbage collection stutters occur ever 2 minutes (is it worth the time investment I need to know how much will I gain I have never play KSP and use the tool yet)?

Im sorry for my load of questions :S  thats a bit embarrassing but I guess with that information I should be good to start and do it

thank you for your time a patience.

Link to comment
Share on other sites

51 minutes ago, truthseeker said:

You use miniavc.dll which is a plugin specific to KPS( KSP-AVC Add-on Version Checker Plugin 1.1.6.2 - MiniAVC ) you can find online to connect with the game.

Where did this come from?  Ignore it, has nothing to do with HeapPadder

51 minutes ago, truthseeker said:

The line [KSPAddon(KSPAddon.Startup.Instantly, false)]  tell the plugin to call your function at a specific moment which is specified in the parameter KSPAddon.Startup.Instantly which I presume is at the start of the game.

essentially, yes

51 minutes ago, truthseeker said:

- The second  parameter is a boolean ,  in this case the parameter is false , what does this parameter do?

It indicates whether it is a   one-time or not runnable module.  Needed when the startup section specifies one of the scenes which gets entered multiple times, such as the SpaceCenter, Flight, Editor, etc.

53 minutes ago, truthseeker said:

 with KIngmaker pathfinder I can use  unity mod manager,  the equivalent of miniavc.dll plugin . The tool got a function that is onMonoUpdate I was thinking to maybe use it to increase the heap.

No idea what that is.  whatever you do, make sure it only executes one time.

 

53 minutes ago, truthseeker said:

- And one last thing how much improvement should I expect with 16 gig in my system if garbage collection stutters occur ever 2 minutes (is it worth the time investment I need to know how much will I gain I have never play KSP and use the tool yet)?

KSP had garbage collection occuring once evert 5-6 seconds.  If you are already at 2 minutes, I wouldn't bother

Link to comment
Share on other sites

20 hours ago, linuxgurugamer said:

KSP had garbage collection occuring once evert 5-6 seconds.  If you are already at 2 minutes, I wouldn't bother

Oh I didn't know KSP was THAT bad!

I though maybe I could get 1 or 2 more minute with this mod, so you think its just a waste of time ?

Link to comment
Share on other sites

4 minutes ago, truthseeker said:

Oh I didn't know KSP was THAT bad!

I though maybe I could get 1 or 2 more minute with this mod, so you think its just a waste of time ?

Generally more garbage collection is better than less.  If you put it off longer, you're making your computer waste RAM, and making each pass take longer.

Link to comment
Share on other sites

Just now, DStaal said:

Generally more garbage collection is better than less.  If you put it off longer, you're making your computer waste RAM, and making each pass take longer.

"Generally more garbage collection is better than less" well in this case with Unity it means more stutter

"If you put it off longer, you're making your computer waste RAM" I dont mind wasting ram as long as I get less stutter. The game only uses 6 gig ram so my Ram just sit there doing nothing isnt that a waste ?

"and making each pass take longer" in this case thats exactly what I what, longer time in between garbage calls, I planned to call the garbage collection myself when the game pauses which is very frequent.

I need to know how much time can I gain by increasing the heap with 16 gig  if a game stutter every minute .

 

Link to comment
Share on other sites

  • 2 months later...
On 2/14/2020 at 1:54 PM, truthseeker said:

"Generally more garbage collection is better than less" well in this case with Unity it means more stutter

"If you put it off longer, you're making your computer waste RAM" I dont mind wasting ram as long as I get less stutter. The game only uses 6 gig ram so my Ram just sit there doing nothing isnt that a waste ?

"and making each pass take longer" in this case thats exactly what I what, longer time in between garbage calls, I planned to call the garbage collection myself when the game pauses which is very frequent.

I need to know how much time can I gain by increasing the heap with 16 gig  if a game stutter every minute .

 

I noticed my game running very smooth upping mine to 10000. I also notice KSP actually uses its frequently leaving about a GB of wiggle.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Is it possible that this mod actually lowered the memory usage of KSP?

I have 64gb system and 46gb is usally free once KSP starts.

I added this mod for the pure stuter reduction, which heppenes to my game after about 4 hours of consistent play in one sitting.

So far all is well.

Prior to adding this mod KSP used 18gb of memory.

Now its 14gb.

No complaints, things are working fine.  But seems odd that the memory usage lowered.

ANyways,  I never setup a cfg, so its using the 32gb stock cfg.

Do I need to or should I make a cfg file that doubles the 32gb stock one and use that?  Or would the 32gb cfg be fine for now.

Link to comment
Share on other sites

16 hours ago, SkiRich said:

Is it possible that this mod actually lowered the memory usage of KSP?

Yes

16 hours ago, SkiRich said:

ANyways,  I never setup a cfg, so its using the 32gb stock cfg.

Do I need to or should I make a cfg file that doubles the 32gb stock one and use that?  Or would the 32gb cfg be fine for now.

That's fine, playing with the cfg doesn't really help that much

Link to comment
Share on other sites

  • 2 weeks later...

In CKAN, the version-compatability hasn't been updated yet. Still need to try the mod anyway (seems like something I could use, I hope it does something for my poor laptop with a baking hot i7 and 8 gigs ddr4), but since I didn't find any problems with it in this thread, I thought, let's give it a mention =]

Link to comment
Share on other sites

5 hours ago, 7pH said:

In CKAN, the version-compatability hasn't been updated yet. Still need to try the mod anyway (seems like something I could use, I hope it does something for my poor laptop with a baking hot i7 and 8 gigs ddr4), but since I didn't find any problems with it in this thread, I thought, let's give it a mention =]

I have over 220 mods, I do not do updates if not needed.  

Tell CKAN that 1.8  mods are compatible and you will be fine

Link to comment
Share on other sites

  • 1 month later...

The message I get is:

HeapAdder, initial mem: 188520, 
minMem: 125528, final mem: 125984

I have 48G on a Mac. Running 1.10.1

For the .cfg file, I added the 4G amount and the 8G amount, to make 12G.

Is this helping? Is it actually taking memory away?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...