package
module
Version:
v0.0.0-...-0304675
Opens a new window with list of versions in this module.
Published: Apr 14, 2023
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
MapSize
How much memory is occupied by map.
go get github.com/520MianXiangDuiXiang520/MapSize
package main
import (
"fmt"
"github.com/520MianXiangDuiXiang520/MapSize"
)
func main() {
m := make(map[int]struct{})
for i := 0; i < 100; i++ {
m[i] = struct{}{}
}
fmt.Println(mapsize.Size(m)) // 1416
}
Documentation
¶
Size returns how many bytes of memory a map occupies,
which is an approximation, but has reference value
m := make(map[int]struct{})
for i := 0; i < 100; i++ {
m[i] = struct{}{}
}
fmt.Println(Size(m)) // 1416
Output:
Source Files
¶
Click to show internal directories.
Click to hide internal directories.