RSS is the amount of memory mapped to physical memory. It doesn’t include memory swapped. Still, if GC was releasing pages back to the OS - unmapping the allocated and touched pages - the RSS should decrease.
There was a previous thread on if and when GC will release pages back to the OS. This is hard to do if you do not have a compacting collector - Go does not - so it is doubtful Go ever releases the pages once allocated to the heap. > On Jul 12, 2021, at 11:20 PM, Kurtis Rader <kra...@skepticism.us> wrote: > > > I didn't look at the source for your program because you don't seem to > understand what "resident set size" means in this context. The RSS of a > process is unrelated to its virtual size. You appear to be equating RSS and > virtual size. This might be an example of the XY Problem.. What Prompted you > to open this discussion thread? > >> On Mon, Jul 12, 2021 at 7:52 PM Chan Lewis <baiw...@gmail.com> wrote: >> Hi, I wrote a test program, which tests when GC starts to return heap space >> to OS. >> Here's the code: https://paste.ubuntu.com/p/jxHqDnsM2T/ >> >> But I've waited for a long time and haven't seen the RSS memory reduced. I >> can't figured out why, Any help ? (go version 1.14.3) >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/a511d995-7f1d-431d-9065-6b6d287a19dan%40googlegroups.com. > > > -- > Kurtis Rader > Caretaker of the exceptional canines Junior and Hank > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_BMdKn_du_REFU0NEyQaBSM979%2BHTGFf3JWmvvohNqJw%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/F1AC03F0-D92D-4087-BF13-5093A5A20DB1%40ix.netcom.com.