19

GO-ruantime-wx5ba3323aac676的博客

 5 years ago
source link: http://blog.51cto.com/13980710/2177572
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
runtime包提供了运行时与系统的交互,比如控制协程函数,触发垃圾立即回收等等底层操作,下面我们就运行时能做的所有事情逐个进行说明与代码演示1.获取GOROOT环境变量2.获取GO的版本号3.获取本机CPU个数4.设置最大可同时执行的最大CPU数5.设置cupprofile记录的速录6.查看cupprofile下一次堆栈跟踪数据7.立即执行一次垃圾回收8.给变量绑定方法,当垃圾回收的时候进行监听

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK