On Wed, May 3, 2017 at 6:28 PM Piotr Narewski <piotr...@gmail.com> wrote:

> I've checked it and I think there is something wrong with this lib.

I haven't checked thoroughly, but it seems to be working as intended. If
you Put(515) the correct bin to use is the one for sizes 257-512. If you
Get(515), the correct bin to use is the [next] one for sizes 513-1024.

Try it differently:

        dat := slice.Bytes.Get(515)
        println(dat)
        slice.Bytes.Put(dat)
        dat = slice.Bytes.Get(515)
        println(dat)

Now the first Get(515) will create (the list.Pool is empty) a new cap(1024)
slice. The subsequent Put returns the slice to the correct bin so the last
println should show the same address.

-- 

-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, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to