linearAlloc问题

最近重新看go源码(1.12版本),对于这块代码有个疑问,为什么增加映射保留空间,l.end不用变化

func (l *linearAlloc) alloc(size, align uintptr, sysStat *uint64) unsafe.Pointer {
    p := round(l.next, align)
    if p+size > l.end {
        return nil
    }
    l.next = p + size
    if pEnd := round(l.next-1, physPageSize); pEnd > l.mapped {
        // We need to map more of the reserved space.
        sysMap(unsafe.Pointer(l.mapped), pEnd-l.mapped, sysStat)
        l.mapped = pEnd
    }
    return unsafe.Pointer(p)
}
已邀请:

要回复问题请先登录注册