Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wshwsh12 committed May 17, 2022
1 parent 639e4c7 commit 6224267
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion util/hack/hack.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ const (
// ref https://github.com/golang/go/blob/go1.15.6/src/reflect/type.go#L2162.
// The bucket size may be changed by golang implement in the future.
// Golang Map needs to acquire double the memory when expanding, and the old buckets will be released after the data is migrated.
// Considering the worst case, we expand the bucket size to 1.5 times to estimate the memory usage of Golang Map.
// Considering the worst case, the data in the old bucket cannot be migrated in time, and the old bucket cannot
// be GCed, we expand the bucket size to 1.5 times to estimate the memory usage of Golang Map.
DefBucketMemoryUsageForMapStrToSlice = (8*(1+16+24) + 16) / 2 * 3
// DefBucketMemoryUsageForMapIntToPtr = bucketSize*(1+unsafe.Sizeof(uint64) + unsafe.Sizeof(pointer))+2*ptrSize
DefBucketMemoryUsageForMapIntToPtr = (8*(1+8+8) + 16) / 2 * 3
Expand Down

0 comments on commit 6224267

Please sign in to comment.