Go’s runtime package provides functions for analying memory usage.
This is an example on how to retrive information on allocated memory and also amount of memory obtained form system.
Note: Go applications reserve large amount of virtual memory, but that is not acutal usage. When using top command in Linux, resident set size (RSS) is the amount of memory actually in use.