mirror of
https://github.com/golang/go
synced 2024-11-06 11:26:12 -07:00
fixalloc: add comment about tail waste
This commit is contained in:
parent
3fe82bdf5e
commit
e08b4c66b8
@ -30,8 +30,8 @@ type fixalloc struct {
|
||||
arg unsafe.Pointer
|
||||
list *mlink
|
||||
chunk uintptr // use uintptr instead of unsafe.Pointer to avoid write barriers
|
||||
nchunk uint32
|
||||
nalloc uint32
|
||||
nchunk uint32 // bytes remaining in current chunk
|
||||
nalloc uint32 // size of new chunks in bytes
|
||||
inuse uintptr // in-use bytes now
|
||||
stat *sysMemStat
|
||||
zero bool // zero allocations
|
||||
@ -57,7 +57,7 @@ func (f *fixalloc) init(size uintptr, first func(arg, p unsafe.Pointer), arg uns
|
||||
f.list = nil
|
||||
f.chunk = 0
|
||||
f.nchunk = 0
|
||||
f.nalloc = uint32(_FixAllocChunk / f.size * f.size)
|
||||
f.nalloc = uint32(_FixAllocChunk / size * size) // Round _FixAllocChunk down to an exact multiple of size to eliminate tail waste
|
||||
f.inuse = 0
|
||||
f.stat = stat
|
||||
f.zero = true
|
||||
|
Loading…
Reference in New Issue
Block a user