I found myself writing code like this:

        s := make([]byte, len)
        for i := 0; i < len; i++ {
                // fill in s with stringy goodness
        }
        return string(s)

Does this reuse the memory in s for the string, or does it allocate new
memory and copy? Or does escape analysis swoop in and make that decision?

        Erich

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

Reply via email to