[go-nuts] Re: understanding memory profile

2017-12-07 Thread Sangjin Lee
It is actually with the latest (1.9.2). I'll file an issue.

Thanks.

On Tuesday, December 5, 2017 at 1:51:07 PM UTC-8, Dave Cheney wrote:
>
> Can you please check if this is happening with the current version of Go 
> and if so raise a bug, https://golang.org/issue/new. 
>
> 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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: understanding memory profile

2017-12-05 Thread Dave Cheney
Can you please check if this is happening with the current version of Go and if 
so raise a bug, https://golang.org/issue/new. 

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


[go-nuts] Re: understanding memory profile

2017-12-05 Thread Sangjin Lee
Mystery solved. It turns out it was coming from bytes.NewBuffer which was 
being invoked in the method I listed. Somehow that was attributed to the 
import line for bytes rather than the line of invocation.

On Tuesday, December 5, 2017 at 10:51:33 AM UTC-8, Dave Cheney wrote:
>
> No idea. Which version of Go are you using?

-- 
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.


[go-nuts] Re: understanding memory profile

2017-12-05 Thread Dave Cheney
No idea. Which version of Go are you using?

-- 
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.


[go-nuts] Re: understanding memory profile

2017-12-05 Thread Sangjin Lee
Thanks for the pointer! I am still puzzled by the former (allocation 
associated with the import line). I thought it could be an init() function 
in this file, but that does not explain it...

On Monday, December 4, 2017 at 5:47:09 PM UTC-8, Dave Cheney wrote:
>
>
>
> On Tuesday, 5 December 2017 12:09:54 UTC+11, Sangjin Lee wrote:
>>
>> A couple of questions on understanding go pprof's memory profile...
>>
>> When I list a certain function (with --alloc_objects), I see an 
>> allocation number associated with an import line mysteriously. I am pretty 
>> certain I can rule out any source line offset. For example,
>>
>> (pprof) list foo
>> Total: 534804146
>> ROUTINE  (snip)
>>   24057960   27540717 (flat, cum)  5.15% of Total
>>  .  .  1:package protocol
>>  .  .  2:
>>  .  .  3:import (
>>   12092676   12092676  4:   "bytes"
>>  .  .  5:   "fmt"
>>  .  .  6:   "net/url"
>>  .  .  7:   "strconv"
>>  .  .  8:   "strings"
>>  .  .  9:   "time"
>>  .  . 10:   "unicode"
>>  .  . 11:)
>>
>> Any idea how to interpret this?
>>
>> In addition, is there a way to drill down further into exactly what type 
>> of memory allocation is contributing to the allocation when I list a 
>> function? The tree/web/pdf view doesn't break down further function names 
>> (only shows the boxes with what I believe is the individual allocation 
>> size). I'm kind of guessing from the line of code on what it is, but it'd 
>> be great if there is a way to track down exactly what type of memory 
>> allocation it is (string copy, map growth, byte allocation, etc.). For 
>> example,
>>
>> (pprof) list add
>> Total: 534804146
>> ROUTINE  (snip)
>>   17248777   17248777 (flat, cum)  3.23% of Total
>>  .  .220: l *logger
>>  .  .221:}
>>  .  .222:
>>  .  .223:func (l *logger) add(data 
>> map[string]interface{}) {
>>  .  .224: if id := l.Id(); id != "" {
>>   17248777   17248777225: data[ID] = id
>>  .  .226: }
>>  .  .227:}
>>  .  .228:
>>
>> where id is a string.
>>
>
> The allocations are taking the address of the value of id when it is boxed 
> into an interface{} 
>

-- 
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.


[go-nuts] Re: understanding memory profile

2017-12-04 Thread Dave Cheney


On Tuesday, 5 December 2017 12:09:54 UTC+11, Sangjin Lee wrote:
>
> A couple of questions on understanding go pprof's memory profile...
>
> When I list a certain function (with --alloc_objects), I see an allocation 
> number associated with an import line mysteriously. I am pretty certain I 
> can rule out any source line offset. For example,
>
> (pprof) list foo
> Total: 534804146
> ROUTINE  (snip)
>   24057960   27540717 (flat, cum)  5.15% of Total
>  .  .  1:package protocol
>  .  .  2:
>  .  .  3:import (
>   12092676   12092676  4:   "bytes"
>  .  .  5:   "fmt"
>  .  .  6:   "net/url"
>  .  .  7:   "strconv"
>  .  .  8:   "strings"
>  .  .  9:   "time"
>  .  . 10:   "unicode"
>  .  . 11:)
>
> Any idea how to interpret this?
>
> In addition, is there a way to drill down further into exactly what type 
> of memory allocation is contributing to the allocation when I list a 
> function? The tree/web/pdf view doesn't break down further function names 
> (only shows the boxes with what I believe is the individual allocation 
> size). I'm kind of guessing from the line of code on what it is, but it'd 
> be great if there is a way to track down exactly what type of memory 
> allocation it is (string copy, map growth, byte allocation, etc.). For 
> example,
>
> (pprof) list add
> Total: 534804146
> ROUTINE  (snip)
>   17248777   17248777 (flat, cum)  3.23% of Total
>  .  .220: l *logger
>  .  .221:}
>  .  .222:
>  .  .223:func (l *logger) add(data 
> map[string]interface{}) {
>  .  .224: if id := l.Id(); id != "" {
>   17248777   17248777225: data[ID] = id
>  .  .226: }
>  .  .227:}
>  .  .228:
>
> where id is a string.
>

The allocations are taking the address of the value of id when it is boxed 
into an interface{} 

-- 
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.