Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于第四章2.2节中的疑问 #82

Open
soooldier opened this issue Sep 27, 2020 · 4 comments
Open

关于第四章2.2节中的疑问 #82

soooldier opened this issue Sep 27, 2020 · 4 comments
Assignees

Comments

@soooldier
Copy link

第四章2.2节中提到 alloc为mspan的指针数组,数组大小为class总数的2倍。数组中每个元素代表了一种class类型的span列表 其中数组中的每个元素代表span列表怎么理解呢?我理解是每个元素只能代表一个span

@RainbowMango
Copy link
Owner

为什么又关掉了

@soooldier
Copy link
Author

@RainbowMango 哈哈哈之前不太确定,所以先关掉了;晚上回来看了下源码,还是觉得alloc数组中的每个元素只代表一个span呀,不能代表span列表。span里prev和next是指向的是mcentral中noempty list中的元素,而mcentral又是跨goroutine的,所以alloc中的单个span并不会代表一个span列表。不知道这么理解对不对,不对的话还请提点一下

@soooldier soooldier reopened this Sep 27, 2020
@RainbowMango
Copy link
Owner

你先继续往下看,这部分内容做个了解即可。
回头我再看下源码答复你。另外,你看的哪个版本的源码?

@soooldier
Copy link
Author

好的好的,感谢~ 我看的1.14,主要的函数是mcentral.go中的cacheSpan

@RainbowMango RainbowMango self-assigned this Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants