> Here some pprof result using go 1.7.1 first and tip later:

If I understand you correctly, you still have questions about memory
management, but the nature of the question has changed from "why does
this function keep increasing memory consumption" to "why does my
program consume so much memory"? I think the former was answered. The
latter boils down to the nature of Go memory management.

A variable called GOGC controls when the next collection will begin.
"A collection is triggered when the ratio of freshly allocated data to
live data remaining after the previous collection reaches this
percentage." GOGC by default is 100, so you roughly double your
used/allocated memory before you start freeing up objects. To monitor
the collection cycles you can run your code with
"GODEBUG=gctrace=1"[1] (see link at bottom for documentation).

Go normally does not return all deallocated memory to the host
immediately after deallocation. That would not be very efficient.
Instead, scavenging happens on certain intervals. gctrace=1 will
output information about that too, the documentation of the format is
again at the link at the bottom.

--
1: https://golang.org/pkg/runtime/

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to