> I'm running a server written in Go. It serves a lot of concurrent
> connections, perhaps many millions per process.
> Currently I don't know how to measure the accurate memory size used,
> and when the process will reach the 16GB memory limit and panics.
> The "top" command shows 2574M on VIRT, and 100M on RES.
> Will the process panics when "VIRT" reaches 16G ?
Assuming you have more than 16Gb of free memory in your machine, and
at no point since the Go process has started it has been subject to
significant paging, then the value reported by top in the RES column
is a reasonable approximation for the amount of memory Go is using at
the moment.
Currently, the maximum size of the 64bit heap is 16Gb. Allocations
that cause the runtime to try to grow the heap above this size will
cause a panic. This limit can be raised by adjusting a few constants
in the runtime. Details are in
http://code.google.com/p/go/issues/detail?id=2142.
> Are there any detailed docs on Go's memory usage?
The best available docs are this mailing list and the source, I
suggest reading runtime/malloc.* and runtime/mgc0.c.
Cheers
Dave