Golang 1.5+中的垃圾回收器改进是否会影响内存释放的数量?

huangapple go评论89阅读模式
英文:

Do Golang garbage collector improvements in 1.5+ affect the amount of memory deallocated?

问题

Google的Go语言在过去的两个主要版本中在垃圾回收器方面取得了巨大的进展。与以前相比,垃圾回收器运行的时间几乎可以忽略不计。我想知道这些改进是否以牺牲其他方面为代价。

Go 1.6在进行垃圾回收时是否像Go 1.4一样释放了同样多的内存?

垃圾回收器在运行时是否实际上释放了所有可能释放的内存,还是为了加快速度而做出了妥协?

英文:

Google's go has been making massive strides in the last 2 major versions to their garbage collector. The amount of time time the garbage collector is running is in near negligible amounts compared to what it was previously. I'm wondering if these improvements are at the sacrifice of anything else.

Does go 1.6 still deallocate just as much on a garbage collection run as go 1.4?

Does the garbage collection actually deallocate everything it possibly could at the point that it runs, or does it make concessions to speed things up?

答案1

得分: 2

这取决于你的堆内存使用模式。主要目标是通过垃圾收集器(GC)更高效地使用内存,并实现更可预测和更短的暂停时间。为了实现这一目标,会增加一些CPU使用率,并且除非必要,否则会将一些垃圾收集推迟到下一次GC运行时。GC将更频繁地运行,并更好地利用可用的核心。一般来说,人们报告的暂停时间更短且更均匀。总的来说,这是一个巨大的改进。Go 1.6在Go 1.5的基础上进行了改进,而Go 1.7将会更好。

仔细编写程序以减少不必要的GC使用对性能有很大影响。

英文:

It depends on your pattern of heap memory usage. The primary goals were efficient use of memory with more predictable and shorter pauses by the garbage collector (GC). To achieve this, there is some increase in CPU usage and, unless necessary, some garbage collection may be postponed to the next run of the GC. The GC will run more often and make better use of available cores. Generally, people report much shorter and more even pauses. Generally, it's a big win. Go 1.6 improves on Go 1.5, which was the first release of the new GC. Go 1.7 will be even better.

Careful programming to reduce unneccessary GC usage makes a big difference to performance.

huangapple
  • 本文由 发表于 2016年2月7日 12:04:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/35249583.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定