On Sun, Aug 30, 2020 at 8:25 AM Sarath Prabath Redlapalli Jaya
<sar...@okcredit.in> wrote:
>
> Hi, we've been observing high memory usage in the following code
> https://github.com/Masterminds/squirrel/blob/master/placeholder.go#L113
>
> We measured from pprof of heap
>
> (pprof) top20
>
> Showing nodes accounting for 360.07MB, 91.31% of 394.32MB total
>
> Dropped 142 nodes (cum <= 1.97MB)
>
> Showing top 20 nodes out of 139
>
>       flat  flat%   sum%        cum   cum%
>
>   101.21MB 25.67% 25.67%   101.21MB 25.67%  bytes.(*Buffer).String

This tells you where the memory was allocated.  If you are trying to
track down a memory leak, you need to look into what is keeping this
memory live in the heap.  The fact that it was allocated here is a
start.  But your next step is to look at what calls to this function
are allocating memory, and what is happening to that memory to keep it
alive.  The pprof program can help tell you where the calls are coming
from, but then you'll have to look at what happens to those strings
and why they are being kept live.

Ian

-- 
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/CAOyqgcUc2fK50YyBJRSuirvR%3DOioTtg%3DC6fL2ovHKNKAVCwB8g%40mail.gmail.com.

Reply via email to