You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this code pattern:
d := data[i:j]
gob.NewDecoder(r).Decode(&d)
gob appears to allocate a new underlying array for d even though there is one present
already. Thus, for the data to be in data[i:j] it will need to be copied from d again:
copy(data[i:j], d)
Ideally, this should not be needed.
The text was updated successfully, but these errors were encountered:
mikioh
changed the title
gob allocates underlying slice array even if already present
encoding/gob: allocates underlying slice array even if already present
Feb 26, 2015
The text was updated successfully, but these errors were encountered: