Disclaimer : I’m not an OS dev, I did read quite a few memory allocator designs and papers, and also tried to implement my own memory allocator at some point, so I probably got some bits wrong, but hopefully largely right about the memory stuff.
That isn’t as big of a problem as you might think. Returning memory to OS is expensive, and even if you call system’s free, the system may not reclaim it anyway(e.g. in C/C++), and system usually reclaims your process’s memory when it exits instead. You don’t get to call free directly in safe Rust, but even when you “release” some heap memory in Rust, it wouldn’t go back to OS immediately.
Garbage collected langauges like Crystal, Elixir/Erlang leave memory management to the runtime, and the runtime handles reuses and so on. So memory not getting freed to the OS is not a problem(since it will be reused later), but the total memory usage keeps growing endlessly is a problem(you’ve got a memory leak).
Obviously GC langauges cannot guarantee memory behaviour absolutely, so depending on the nature of your server, this may or may not be acceptable. If your server is for critical systems like flight controller on airplanes, then this is obviously not acceptable and you need something that doesn’t exhibit dynamic memory behaviour at all. But since you’re just using it for a game server, then you can tolerate a slight bit of randomess w.r.t memory use(e.g. you may get 1-2MB memory leak due to GC and memory fragmentation every now and then and that’s okay).
Rust feels a bit functional at places, but still overall an imperative language, which may or may not be a problem for you? Elixir/Erlang is best for most servers imo, so it might be worth the effort to get used to functional paradigm if you need to write a lot of servers in future.
The internal message handling of TCP packets is left completely to your program logic, so there’s nothing stopping you from decoding and encoding the messages to interact with the Godot engine(it also means there’s nothing inside TCP libs in whatever language would help you either).
Similar to answer above, probably not. OS deals with memory in pages(4KiB(?) sized memory chunks), so even if OS wants to reclaim your memory, you need to clear an entire page first, and even then the memory allocator(e.g. jemalloc) may not return the page back to OS either.
I think you don’t need to be too worried about freeing memory back to OS if you keep memory usage largely constant, which is usually the goal for servers. Somewhat more importantly, it is really difficult to enforce freeing since the OS’s memory allocator’s actual behaviour is not under your control anyway, so even if you “freed” your memory, it may still be held by the allocator, and is still equivalent to “staying in use forever”.
If you want to try this behaviour, just do some random large allocations in C/C++, then free it and check the task manager, the memory usage shouldn’t change too much.