英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论