https://play.golang.org/p/7ZAN9AuEGfD

It seems the length of a slice is not considered by unsafe.SizeOf 
<https://golang.org/pkg/unsafe/#Sizeof>. I assume this is a side effect of 
.SizeOf being evaluated at compile time?

What are other idiomatic ways to determine the runtime memory use of a 
struct which contains (among other things) slices? For instance, I would 
expect an output of 8+8+100*2=216 bytes for bar{A: 100, B: 200, C: 
make([]int16, 100)} if bar is defined as:

type bar struct {
A int64
B int64
C []int16
}

Thanks,
Ingo

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

Reply via email to