To be honest, i'm not totally sure, what is see is that memory keep raising 
until the device crash for out of memory, but what does it mean if 
reachable object remain constant, but the " Heap objects" keep raising? 
Even when i manualy trigger the GC!
Also the reachable object is not exported from runtime.ReadMemStats(), and 
i'm not sure that the stats from the heapview software are correct.
Thankyou for your help


On Wednesday, February 10, 2021 at 12:39:13 AM UTC+1 Uli Kunitz wrote:

> I looked at your data again. Are you sure that you have a memory leak? 
> According to the heap dump you have less reachable objects after 7 days 
> than before. The reachable object size is in both cases 1.6 MByte. The live 
> heap is a little bit larger than seven days before, but is probably caused 
> by fragmentation and appears to me acceptable. The overall heap size 
> increased by 4 MB, but it means that you probably need that size to handle 
> requests. 
>
> You can check that by enabling GODEBUG=gctrace=1. Your program has only a 
> memory leak if the live heap size increases continuously. BTW you can set 
> the environment variable and start the program that calls your program. You 
> might keep your heap size a little bit smaller by setting GOGC to a smaller 
> value than 100.  Here is a helpful article: 
> https://dave.cheney.net/tag/godebug
>
> On Tuesday, February 9, 2021 at 10:43:42 PM UTC+1 Miles Hex wrote:
>
>> Thank you, tomorrow i will try it!
>> Do you know if it possible to enable it without changing the enviroment 
>> variable? My application is started by another one and i can't (easily) 
>> change the enviroment variables. 
>> On Tuesday, February 9, 2021 at 8:57:36 PM UTC+1 Uli Kunitz wrote:
>>
>>> It is GODEBUG=allocfreetrace=1 . Documentation for GODEBUG can be found 
>>> here: https://pkg.go.dev/runtime
>>>
>>> On Tuesday, February 9, 2021 at 8:39:27 PM UTC+1 Uli Kunitz wrote:
>>>
>>>> GODEBUG=allocfreetrace may be what you are looking for. You might want 
>>>> to check the output with sort | uniq -c.
>>>>
>>>> On Tuesday, February 9, 2021 at 8:05:23 PM UTC+1 Miles Hex wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm using golang (1.15.6) to write a daemon that handle system 
>>>>> task(network, time, updates, etc..)  in embedded device (an onion omega 
>>>>> 2+), and i'm encountering a small memory leak that i'm unable to identify 
>>>>> and fix. 
>>>>> The device is using linux 4.14.171, the architecture is mips.
>>>>>
>>>>> At first i used "go tool pprof" and the memory profile but the "inuse" 
>>>>> index is always empty, and that kinda match my expectation since the 
>>>>> application spend most of his time idle awaiting commands/event (i must 
>>>>> add 
>>>>> that he leak occur even when the application is idle). I also checked the 
>>>>> number of goroutine that remains constant. 
>>>>>
>>>>> I then added some logs to try to understand when this allocation 
>>>>> occurs (and the subsequent leak), but i'm unable to make sense of the 
>>>>> data.
>>>>> I also collected a couple of heapdump that i'm trying to analyze with 
>>>>> "github.com/temorfeouz/heapdump14" (which is a fork of 
>>>>> https://github.com/randall77/heapdump14, and the only tool i find 
>>>>> that can open heapdump of go 1.15)
>>>>>
>>>>> Following is the (partial) memstat data:
>>>>>
>>>>> MemStast Before:
>>>>>   "HeapAlloc": 1811448,
>>>>>   "HeapSys": 7176192,
>>>>>   "HeapIdle": 4399104,
>>>>>   "HeapInuse": 2777088,
>>>>>   "HeapReleased": 3358720,
>>>>>   "HeapObjects": 11200,
>>>>>   "StackInuse": 1212416,
>>>>>   "StackSys": 1212416,
>>>>>
>>>>> MemStat After 7 days:
>>>>>   "HeapAlloc": 2033048,
>>>>>   "HeapSys": 11403264,
>>>>>   "HeapIdle": 8257536,
>>>>>   "HeapInuse": 3145728,
>>>>>   "HeapReleased": 8257536,
>>>>>   "HeapObjects": 13060,
>>>>>   "StackInuse": 1179648,
>>>>>   "StackSys": 1179648,
>>>>>
>>>>> I also have the summary from the two heapdump
>>>>> Before:
>>>>> Heap size: 8.0 MB bytes 
>>>>> Heap live: 1.8 MB bytes 
>>>>> Heap objects: 11496 
>>>>> Reachable objects: 10492 
>>>>> Reachable size: 1.6 MB bytes 
>>>>>
>>>>> After 7 days:
>>>>> Heap size: 12.0 MB bytes 
>>>>> Heap live: 2.0 MB bytes 
>>>>> Heap objects: 13198 
>>>>> Reachable objects: 10454 
>>>>> Reachable size: 1.6 MB bytes 
>>>>>
>>>>> I have collected a lot more data, including all the profile made 
>>>>> available from the go runtime and various system information.
>>>>>
>>>>> If i'm reading this data correctly there is a memory leak as the heap 
>>>>> si growing but i'm not sure how to find it! I tough i could try to diff 
>>>>> the 
>>>>> two heapdump with excel but the tool that i'm using is not very "precise" 
>>>>> and a lot of type information seem to be lost.
>>>>>
>>>>> I don't know how to make sense of this data, what would your next 
>>>>> step? I'm quite new in the golang ecosystem and i'm unsure how to move 
>>>>> from 
>>>>> here.
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>

-- 
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/941a3263-ddeb-4933-b0e2-17ac7dc5a818n%40googlegroups.com.

Reply via email to