我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在go中释放内存?

I have a structure:

type xyz struct {
    x int
    y string
}

func f(){
    x := new(xyz) //allocating memory
}

But I cannot find any method to deallocate it in go.

  • Is it not needed to deallocate it in golang?
  • Is there any useful document for how memory allocation/deallocation happens in go?

Go is garbage collected language. You do not have to deallocate memory.

Articles on memory allocation and deallocation in Go.

  1. Garbage collection
  2. Heap and stack allocation
  3. Discussion on allocation optimization
  4. Variable allocation

近期文章

  • 恐慌中的恐慌
  • 如何在Revel Golang中获取POST参数
  • 在golang中无法捕获upstart发送的SIGTERM
  • 指针接收器与值接收器的混淆[重复]
  • 如何使Go Coverage HTML具有浅色背景?
  • 时间,以天,小时,分钟,秒的格式表示
  • 为什么在下面的Go代码中不能使用空白标识符?
  • go-如何为空界面使用gorp select
  • 如何将GO Gorilla Mux路线拆分为同一包的2个独立文件
  • Golang:具有多重继承的接口的意义是什么?
  • 此类型声明的含义是什么?
  • Go中的类型和减法
  • 注重性能的桌面程序:Ruby还是Go?
  • goroutines导致严重的减速和头痛
  • `size * = b-a`是什么意思?
  • 设置Cookie的最大使用期限; 失去最大年龄
  • 如何释放存储空间? [重复]
  • 如何在Golang中初始化接口数组?
  • 来自其他软件包的golang结构
  • 如何获得onListItemClick 值再传到另一个 activity中

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华