V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  vzard  ›  全部回复第 1 页 / 共 1 页
回复总数  7
2021-06-14 23:37:51 +08:00
回复了 auariari 创建的主题 求职 数据分析/数据开发岗,实习可达六个月,求内推~
字节感兴趣么
2021-03-18 20:11:25 +08:00
回复了 zhoudaiyu 创建的主题 Kubernetes K8S 有没有能直接重新 Pod 中的 container 的 API?
内网仓库拉镜像应该很快的
2021-02-22 11:17:36 +08:00
回复了 vzard 创建的主题 酷工作 [内推]字节跳动 2021 研发类实习生招聘开始!
楼主 QQ: 2942708438 感兴趣可以加我私聊,跟进进度 :-)
2021-02-22 11:15:12 +08:00
回复了 vzard 创建的主题 酷工作 [内推]字节跳动 2021 研发类实习生招聘开始!
@ch2 哈哈哈,是实习岗位呀
2020-10-31 21:51:32 +08:00
回复了 vzard 创建的主题 问与答 golang 切片的一个奇怪的现象
找到原因了,是切片内存自动扩容和缩容的坑:
```
// The append built-in function appends elements to the end of a slice. If
// it has sufficient capacity, the destination is resliced to accommodate the
// new elements. If it does not, a new underlying array will be allocated.
// Append returns the updated slice. It is therefore necessary to store the
// result of append, often in the variable holding the slice itself:
// slice = append(slice, elem1, elem2)
// slice = append(slice, anotherSlice...)
// As a special case, it is legal to append a string to a byte slice, like this:
// slice = append([]byte("hello "), "world"...)
func append(slice []Type, elems ...Type) []Type
```
当 cap 不够的时候会自动扩容,当多次执行`track = track[:len(track)-1]`这样的操作之切片又会自动缩容,每次扩容和缩容都会导致底层数组的内存重新申请,每两次内存重新申请之前的 append 的值就会一样,增加日志可以验证:
```
Cap Before: 1, track: [5]
Cap Before: 2, track: [5 4]
Cap Before: 4, track: [5 4 6]
Cap Before: 4, track: [5 4 6 2]
Cap After: 4, track: [5 4 6]
Cap After: 4, track: [5 4]
Cap Before: 4, track: [5 4 2]
Cap Before: 4, track: [5 4 2 6]
Cap After: 4, track: [5 4 2]
Cap After: 4, track: [5 4]
Cap After: 2, track: [5]
Cap Before: 2, track: [5 6]
Cap Before: 4, track: [5 6 4]
Cap Before: 4, track: [5 6 4 2]
Cap After: 4, track: [5 6 4]
Cap After: 4, track: [5 6]
Cap Before: 4, track: [5 6 2]
Cap Before: 4, track: [5 6 2 4]
Cap After: 4, track: [5 6 2]
Cap After: 4, track: [5 6]
Cap After: 2, track: [5]
Cap Before: 2, track: [5 2]
Cap Before: 4, track: [5 2 4]
Cap Before: 4, track: [5 2 4 6]
Cap After: 4, track: [5 2 4]
Cap After: 4, track: [5 2]
Cap Before: 4, track: [5 2 6]
Cap Before: 4, track: [5 2 6 4]
Cap After: 4, track: [5 2 6]
Cap After: 4, track: [5 2]
Cap After: 2, track: [5]
Cap After: 1, track: []
Cap Before: 1, track: [4]
Cap Before: 2, track: [4 5]
Cap Before: 4, track: [4 5 6]
Cap Before: 4, track: [4 5 6 2]
Cap After: 4, track: [4 5 6]
Cap After: 4, track: [4 5]
Cap Before: 4, track: [4 5 2]
Cap Before: 4, track: [4 5 2 6]
Cap After: 4, track: [4 5 2]
Cap After: 4, track: [4 5]
Cap After: 2, track: [4]
Cap Before: 2, track: [4 6]
Cap Before: 4, track: [4 6 5]
Cap Before: 4, track: [4 6 5 2]
Cap After: 4, track: [4 6 5]
Cap After: 4, track: [4 6]
Cap Before: 4, track: [4 6 2]
Cap Before: 4, track: [4 6 2 5]
Cap After: 4, track: [4 6 2]
Cap After: 4, track: [4 6]
Cap After: 2, track: [4]
Cap Before: 2, track: [4 2]
Cap Before: 4, track: [4 2 5]
Cap Before: 4, track: [4 2 5 6]
Cap After: 4, track: [4 2 5]
Cap After: 4, track: [4 2]
Cap Before: 4, track: [4 2 6]
Cap Before: 4, track: [4 2 6 5]
Cap After: 4, track: [4 2 6]
Cap After: 4, track: [4 2]
Cap After: 2, track: [4]
Cap After: 1, track: []
Cap Before: 1, track: [6]
Cap Before: 2, track: [6 5]
Cap Before: 4, track: [6 5 4]
Cap Before: 4, track: [6 5 4 2]
Cap After: 4, track: [6 5 4]
Cap After: 4, track: [6 5]
Cap Before: 4, track: [6 5 2]
Cap Before: 4, track: [6 5 2 4]
Cap After: 4, track: [6 5 2]
Cap After: 4, track: [6 5]
Cap After: 2, track: [6]
Cap Before: 2, track: [6 4]
Cap Before: 4, track: [6 4 5]
Cap Before: 4, track: [6 4 5 2]
Cap After: 4, track: [6 4 5]
Cap After: 4, track: [6 4]
Cap Before: 4, track: [6 4 2]
Cap Before: 4, track: [6 4 2 5]
Cap After: 4, track: [6 4 2]
Cap After: 4, track: [6 4]
Cap After: 2, track: [6]
Cap Before: 2, track: [6 2]
Cap Before: 4, track: [6 2 5]
Cap Before: 4, track: [6 2 5 4]
Cap After: 4, track: [6 2 5]
Cap After: 4, track: [6 2]
Cap Before: 4, track: [6 2 4]
Cap Before: 4, track: [6 2 4 5]
Cap After: 4, track: [6 2 4]
Cap After: 4, track: [6 2]
Cap After: 2, track: [6]
Cap After: 1, track: []
Cap Before: 1, track: [2]
Cap Before: 2, track: [2 5]
Cap Before: 4, track: [2 5 4]
Cap Before: 4, track: [2 5 4 6]
Cap After: 4, track: [2 5 4]
Cap After: 4, track: [2 5]
Cap Before: 4, track: [2 5 6]
Cap Before: 4, track: [2 5 6 4]
Cap After: 4, track: [2 5 6]
Cap After: 4, track: [2 5]
Cap After: 2, track: [2]
Cap Before: 2, track: [2 4]
Cap Before: 4, track: [2 4 5]
Cap Before: 4, track: [2 4 5 6]
Cap After: 4, track: [2 4 5]
Cap After: 4, track: [2 4]
Cap Before: 4, track: [2 4 6]
Cap Before: 4, track: [2 4 6 5]
Cap After: 4, track: [2 4 6]
Cap After: 4, track: [2 4]
Cap After: 2, track: [2]
Cap Before: 2, track: [2 6]
Cap Before: 4, track: [2 6 5]
Cap Before: 4, track: [2 6 5 4]
Cap After: 4, track: [2 6 5]
Cap After: 4, track: [2 6]
Cap Before: 4, track: [2 6 4]
Cap Before: 4, track: [2 6 4 5]
Cap After: 4, track: [2 6 4]
Cap After: 4, track: [2 6]
Cap After: 2, track: [2]
Cap After: 1, track: []

```
2020-08-04 22:48:36 +08:00
回复了 ryncsn 创建的主题 分享创造 分享一下一个可能用得上的 Linux 下的内存分析工具
系统信息:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.6.1810 (Core)
Release: 7.6.1810
Codename: Core

源码安装报错:
rc/tui.c:26:21: 致命错误:ncurses.h:没有那个文件或目录
#include <ncurses.h>
^
编译中断。
make: *** [src/tui.o] 错误 1
2019-03-25 19:12:33 +08:00
回复了 zhang1215 创建的主题 上海 在上海月薪税前 11K 能活下来吗?
@sagaxu 上海 2000 居然可以租到这样的房子,看来北京真是太贵了。。。
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1132 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 20ms · UTC 23:13 · PVG 07:13 · LAX 15:13 · JFK 18:13
Developed with CodeLauncher
♥ Do have faith in what you're doing.