Golang内存占用检测

Golang 内存占用检测 参考链接 https://lrita.github.io/2017/05/26/golang-memory-pprof/ 涉及命令 go tool pprof http://{host}/debug/pprof/heap 缘由 同样的服务在上了多组服务器后监控显示内存 process_resident_memory_bytes 区别很大,多组服务会根据实际连接和用户情况增减,但有一组数值仍然居高不下,数据对比就是20+M和50+M。以下便找出两台作为对比定位原因。{host1}为需要检测的服务。 命令使用 通过 go tool pprof http://{host}/debug/pprof/heap 进入查看命令行,直接输入 top 后 [WenpiCai@LOCAL-192-168-97-55 ~]$ go tool pprof http://{host1}/debug/pprof/heap Fetching profile over HTTP from http://{host1}/debug/pprof/heap Saved profile in /home/WenpiCai/pprof/pprof.MoziGateA.alloc_objects.alloc_space.inuse_objects.inuse_space.006.pb.gz File: MoziGateA Type: inuse_space Time: Jan 14, 2021 at 10:26am (CST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 5524.47kB, 100% of 5524.47kB total Showing top 10 nodes out of 41 flat flat% sum% cum cum% 1542.
Read more →

Linux命令nc

Read more →

Sed命令

Read more →

Git提交规范

Read more →

Goroutine请求TCP返回读取问题

Read more →

Git推送多个仓库

Read more →

快速删除

Read more →

Golang指定时区

Read more →

Golang信号发送与接收

Read more →

Golang整数范围

参考链接 https://stackoverflow.com/questions/6878590/the-maximum-value-for-an-int-type-in-go https://groups.google.com/group/golang-nuts/msg/71c307e4d73024ce?pli=1 The germane part: Since integer types use two’s complement arithmetic, you can infer the min/max constant values for int and uint. For example, > const MaxUint = ^uint(0) > const MinUint = 0 > const MaxInt = int(MaxUint >> 1) > const MinInt = -MaxInt - 1 > As per @CarelZA's comment: golang uint8 : 0 to 255 uint16 : 0 to 65535 uint32 : 0 to 4294967295 uint64 : 0 to 18446744073709551615 int8 : -128 to 127 int16 : -32768 to 32767 int32 : -2147483648 to 2147483647 int64 : -9223372036854775808 to 9223372036854775807
Read more →