Original Post — Direct link
almost 5 years ago - /u/Alistair_Mc - Direct link

Originally posted by Exosumo

Well, you can see why in the actual clip bottom left (garbage collector):

Before freeze - 2384 MB

After freeze - 2136MB

From https://rust.facepunch.com/blog/february-update -

If you have a lot of RAM you can help the algorithm by increasing the gc.buffer convar. The default value is 256MB, which means it will perform a collection at suitable moments after 128MB (or 50% of gc.buffer) and it will always perform a collection at any moment after 256MB (or 100% of gc.buffer). We expect the default value to be entirely sufficient for the entity and player counts on official servers.

2384 - 2136 = 248MB (pretty close to 256 as hardlimit)

I always set gc.buffer to max value of 2048 and I rarely get any lagspikes :)

This is the correct answer and with good responses.

Hey Facepunch, when u fix this?

Unfortunately, GC has to happen and there is no way around it, we're always trying to reduce memory allocations when and where possible and attempting to force garbage collections outside of vital tasks such as combat.

Unity 2019 has an experimental feature called incremental garbage collection which we'll explore in the coming months. Incremental garbage collection spreads the collection over multiple frames instead of causing one freeze. This is yet to be tested so we can't make any promises.

almost 5 years ago - /u/Alistair_Mc - Direct link

Originally posted by Exosumo

What clarifies as "suitable moments"? If I may ask.

We only attempt to stop GC during combat and while moving, any other actions we do not attempt to prevent GC.