func h() []*int {
        s := []*int{new(int), new(int), new(int), new(int)}
        // 使用此s切片 ...

        s[0], s[len(s)-1] = nil, nil // 指针指向的两个int可以被回收
        return s[1:3:3]
    }
posted @ 2020-05-27 20:36  是的哟  阅读(1678)  评论(0)  编辑  收藏  举报