Re: [go-nuts] Memory use of a value

2017-04-13 Thread Jesper Louis Andersen
I think the most extreme variant of this sharing is when you build up a "binary tree" that keeps pointing both left and right pointers to the same underlying structure. A tree of size K is supposed to have around 2^K nodes but in reality the memory layout is around K nodes in size. Suppose we defin

Re: [go-nuts] Memory use of a value

2017-04-13 Thread Ian Lance Taylor
On Thu, Apr 13, 2017 at 9:31 AM, wrote: > https://play.golang.org/p/swRxxCbb65 > > Surely s1 uses more than 8 bytes. Unfortunately, your question is not well defined. s1 itself is 8 bytes. If you write `s3 := s1` and ask for the size of s3, it too will be 8 bytes. There is also string data in

Re: [go-nuts] Memory use of a value

2017-04-13 Thread Ian Lance Taylor
On Thu, Apr 13, 2017 at 9:31 AM, wrote: > https://play.golang.org/p/swRxxCbb65 > > Surely s1 uses more than 8 bytes. Unfortunately, your question is not well defined. s1 itself is 8 bytes. If you write `s3 := s1` and ask for the size of s3, it too will be 8 bytes. There is also string data in

Re: [go-nuts] Memory use of a value

2017-04-13 Thread Jan Mercl
On Thu, Apr 13, 2017 at 6:31 PM wrote: > https://play.golang.org/p/swRxxCbb65 > > Surely s1 uses more than 8 bytes. no -- -j -- 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, s

Re: [go-nuts] Memory use of a value

2017-04-13 Thread sdickey
https://play.golang.org/p/swRxxCbb65 Surely s1 uses more than 8 bytes. On Thursday, April 13, 2017 at 11:28:39 AM UTC-5, Jan Mercl wrote: > > On Thu, Apr 13, 2017 at 6:24 PM AWildTyphlosion < > sdi...@watchtower-security.com > wrote: > > > I'm trying to figure out how much memory a value. Anyone

Re: [go-nuts] Memory use of a value

2017-04-13 Thread Jan Mercl
On Thu, Apr 13, 2017 at 6:24 PM AWildTyphlosion < sdic...@watchtower-security.com> wrote: > I'm trying to figure out how much memory a value. Anyone have a clue how to? unsafe.Sizeof/reflect.Type.Size -- -j -- You received this message because you are subscribed to the Google Groups "golang

[go-nuts] Memory use of a value

2017-04-13 Thread AWildTyphlosion
I'm trying to figure out how much memory a value. Anyone have a clue how to? -- 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