Hi.
I’m trying to find a memory leak in my application.
I’ve added some runtime memory stats to the logs (Heap & Stack stats.. go routine and heapObject counts).
I can see that from time to time m.StackInuse is increasing without any obvious reason from the application perspective (At least not one that I can find yet).
Here some additional runtime mem stats (Taken at the same time):
StackInUse 56MB
HeapSys: 147MB.
HeapAlloc: 97MB
While StackInUse and HeapSys seems to increase from time to time, HeapAlloc stays about the same during 6 hours while the application is running.
There seems to be a bit of correlation between StackInUse and HeapSys, but overtime StackInUse increase more than HeapSys. (Is HeapSize includes StackInUse?)
In addition to adding runtime memory logs, I’m also creating periodic heap profile dumps.
My problem is that when analyzing the heap with pprof, it gives me no clue why StackInUse is so high.
The pprof inuse_space shows:
“Showing nodes accounting for 55.31MB, 93.25% of 59.31MB total”
What this total MB represent? It doesn’t seem to match HeapAlloc, HeapSys or StackInUse.
Does pprof heap profile even include StackInUse?
I really need to understand where the leak is coming from, but after looking in many places, the memory stats are still not clear to me, and neither what memory stat pprof heap profile really represent.
Note that I’m also logging HeapObjects count and I don’t see any leak there… It’s just StackInUse increasing from time to time (As it seems, it's always double itself... ~8MB->16MB->32), and HeapSys.
Note that I’m also using Cgo, but my understanding is Cgo memory allocations will not be reflected by the runtime memory stats. Is this correct and I assume if runtime memory stats are increasing this is defiantly because of go code and not C code?
I hope I was clear, but added a screenshot for the different memory stats.
Marked in red the point in times that stackInUse increase. (My current understanding which might be wrong, is that stackInUse is not included in HeapSys, this is why they are stacked in the graph).
I know my write is a bit messed up and you might not really be sure what's being asked, so in if I'll try to summarize:
<Untitled.jpg>--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e7bedd37-76a2-48e9-82bb-6309c60787bbn%40googlegroups.com.
<Untitled.jpg>
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAAbwE0McE6OULqOyrjHtw6tp493%3DLeDm624_tck71RDfkN%2BOEQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAAbwE0O6Wj2ngcGymiJhrwUxOJLQ_5TZbJgqWnqm_c_BZc8-bQ%40mail.gmail.com.
e.g. 2h on ~8MB before doubled to 16MB, 4h on 16MB before doubled to 32MB, 8h on 32MB before doubled to 64MB
According to this thread:
https://stackoverflow.com/questions/25317838/how-to-identify-the-stack-size-of-goroutine
As of go 1.3 it also uses an exponentially increasing stack size....