Jump to content

Search the Community

Showing results for tags 'gc'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements
    • Welcome Aboard
  • Kerbal Space Program 2
    • KSP2 Dev Updates
    • KSP2 Discussion
    • KSP2 Suggestions and Development Discussion
    • Challenges & Mission Ideas
    • The KSP2 Spacecraft Exchange
    • Mission Reports
    • KSP2 Prelaunch Archive
  • Kerbal Space Program 2 Gameplay & Technical Support
    • KSP2 Gameplay Questions and Tutorials
    • KSP2 Technical Support (PC, unmodded installs)
    • KSP2 Technical Support (PC, modded installs)
  • Kerbal Space Program 2 Mods
    • KSP2 Mod Discussions
    • KSP2 Mod Releases
    • KSP2 Mod Development
  • Kerbal Space Program 1
    • KSP1 The Daily Kerbal
    • KSP1 Discussion
    • KSP1 Suggestions & Development Discussion
    • KSP1 Challenges & Mission ideas
    • KSP1 The Spacecraft Exchange
    • KSP1 Mission Reports
    • KSP1 Gameplay and Technical Support
    • KSP1 Mods
    • KSP1 Expansions
  • Community
    • Science & Spaceflight
    • Kerbal Network
    • The Lounge
    • KSP Fan Works
  • International
    • International
  • KerbalEDU
    • KerbalEDU
    • KerbalEDU Website


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL



About me



Found 1 result

  1. This started as a simple plugin that displays a graph of the Mono heap allocation rate and garbage collection, mainly intended as a troubleshooting and development aid rather than for general use (hence why I originally released it in the Add-on Development sub-forum rather than this one). However, I have since devised a way to force Mono to keep significantly more free space in the heap, which can significantly reduce the frequency at which the heap fills up and the Mono garbage collection causes a stutter, so I have added it to this mod and released it more publicly. I will be continuing to work on this mechanism to improve it further. The code has been highly optimised to create as little garbage as possible (given the constraints of the old OnGUI based API) so that it interferes with what it's measuring as little as possible. I do have plans to add various "usability" type enhancements but only things that can be implemented cleanly and are directly useful for the mods purpose. To install, simply download the zip from the link below and copy the MemGraph folder from the zip file into the GameData folder of your KSP installation. Mod-KeypadMultiply toggles the display of the window. Mod-KeypadPlus increases the vertical scale of the graph. Mod-KeypadMinus decreases the vertical scale of the graph. Mod-KeypadDivide runs a bit of test code controlled by MemGraph\PluginData\test.cfg Mod-End pads the Mono heap with a configurable amount of headroom to reduce frequency of garbage collections. Every second the plugin totals up all the memory allocated on the heap and whether any garbage collections have run. It also displays the current total heap allocation, the maximum heap allocation just before the last garbage collection, the minimum just after the last collection, the number of "render" and "physics" updates and the time between the previous two collections. The graph is 600 pixels wide and shows the last 10 minutes of the memory allocation in green. If a garbage collection happens during the interval, that column of the graph will have a red background. The test code basically allocates a number of blocks of the specified size and displays which allocations actually cause the allocated heap to change. This allows us to deduce various characteristics of the memory allocator and garbage collection mechanisms (and was a crucial part of developing the heap padding mechanism). Mod-End activates the heap padding. The amount of padding is controlled by the MemGraph\PluginData\padheap.cfg. The format of the file is very simple. Each line controls the amount of padding allocated for blocks of each size range. The first value is the size of each block allocated and the second is the number of blocks. The first values are only present for illustration, they don't actually control the size of the blocks, these are hardwired to the sizes in the default configuration. The total value at the end is the total number of megabytes of padding allocated (note, the memory usage of KSP will increase by more than this due to the free space headroom maintained by Unity). I recommend that you run the game normally and load up a situation that has noticeable stutter. Display the graph, setting the scale so the regular allocation rate fits nicely and the garbage collection red lines can be seen. Let it run for several runs of the garbage collector and then hit Mod-End. After a short pause, the game should continue with a considerably larger gap between the collections. After another few collections hit Mod-End again and it may improve further. I would appreciate feedback about how well this works, e.g. screenshots of the graph taken during this process and after another few collections would be very helpful along with details about your setup (and preferably, an output_log.txt/player.log file). Many thanks to @Tig for the testing and very well presented data he posted over in the Grumpy Collector thread. One other thing I should add, though it should be obvious with only a little thought, is that the heap padding mechanism is only intended for 64 bit versions of the game. Trying to allocate 900 MB of extra heap space on the 32 bit version is unlikely to be successful and, if it is, then it will probably cause the game to crash before long due to running out of address space. It is also unlikely to work effectively if your machine has only 4GB of RAM as the total usage of KSP is likely to grow close to 4GB even without loading a save, resulting in virtual memory paging which will seriously hurt performance. Obligatory picture of mod in use: Download MemGraph for KSP 1.2.x and 1.3 Download MemGraph for KSP 1.1.x Source on GitHub Previous releases on GitHub (versions 1.0.0.x are for KSP 1.1.x, versions 1.1.0.x are for KSP 1.2). The code is released under the MIT license (see https://github.com/Gerry1135/MemGraph/blob/master/Graph.cs). There's no obligation and it won't entitle you to any special treatment but, if you feel like it, then you can make a donation using the link below. Donate Here
  • Create New...