首页 > 其他 > 详细

Go中map的内存模型

时间:2020-11-20 23:46:11      阅读:36      评论:0      收藏:0      [点我收藏+]
type hmap struct {
    count     int    // 元素的个数
    flags     uint8  // 状态标志
    B         uint8  // 可以最多容纳 6.5 * 2 ^ B 个元素,6.5为装载因子
    noverflow uint16 // 溢出的个数
    hash0     uint32 // 哈希种子

    buckets    unsafe.Pointer // 桶的地址
    oldbuckets unsafe.Pointer // 旧桶的地址,用于扩容
    nevacuate  uintptr        // 搬迁进度,小于nevacuate的已经搬迁
    overflow *[2]*[]*bmap 
}

以上是map在标准库中的定义

这篇文章写的很有深度
参考: https://www.cnblogs.com/sunsky303/p/11815172.html

Go中map的内存模型

原文:https://www.cnblogs.com/it3rry/p/14013407.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!