go语言检查内存泄露

本文通过示例展示了如何使用Go语言内置的pprof工具来检测内存泄露,重点关注了`reflect.unsafe_NewArray`和`database/sql.convertAssign`函数可能导致的内存占用。内容包括了获取和解析内存剖析报告,以及如何进一步分析内存泄露的位置。
摘要由CSDN通过智能技术生成
[root@s3 twitter]# go tool pprof http://localhost:6060/debug/pprof/heap --text
Read http://localhost:6060/debug/pprof/symbol
Fetching /pprof/heap profile from localhost:6060 to
  /tmp/76z7mNTrzO
Wrote profile to /tmp/76z7mNTrzO
Adjusting heap profiles for 1-in-524288 sampling rate
Total: 47.5 MB
    24.5  51.6%  51.6%     24.5  51.6% reflect.unsafe_NewArray
    23.0  48.4% 100.0%     23.0  48.4% database/sql.convertAssign
     0.0   0.0% 100.0%     23.0  48.4% database/sql.(*Rows).Scan
     0.0   0.0% 100.0%     47.5 100.0% github.com/coopernurse/gorp.(*DbMap).Select
     0.0   0.0% 100.0%     47.5 100.0% github.com/coopernurse/gorp.hookedselect
     0.0   0.0% 100.0%     47.5 100.0% github.com/coopernurse/gorp.rawselect
     0.0   0.0% 100.0%     47.5 100.0% main.getTwitterNoParse
     0.0   0.0% 100.0%     27.5  57.9% main.main
     0.0   0.0% 100.0%     47.5 10
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值