I know there are tons of threads about it. And I read a few of them.
I am wondering if GC.Collect(); correct in my case GC.Collect();
I have a server for MMORPG, in production it works day and night. And the server restarts every other day to implement changes in the production code base. Every twenty minutes, the server pauses all other threads and serializes the current state of the game. This usually takes from 0.5 to 4 seconds.
It would be a good idea to GC.Collect(); after serialization?
The server, obviously, constantly creates and destroys game elements.
Will I have a known profit in performance or memory optimization / utilization?
Should not be manually assembled?
I read about how collecting can be bad if it is used at the wrong moments or too often, but I think these savings are a good time to collect, and not so often.
The server is in framework 4.0
Update in response to comment:
We accidentally encounter a server hang, sometimes unexpectedly the server’s memory usage will increase until it reaches the point where the server has been doing any network operation for too long. Thus, I consider many different approaches to solving the problem, this is one of them.
source share