golang pprof 内存分析
use pprof to get application memory useage
add code in your main funciton
import (
"log"
_ "net/http/pprof"
) func main() {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
}
build and compile you application.
let application run and send request then run
#get memory useage
go tool pprof -inuse_space http://127.0.0.1:6060/debug/pprof/heap
go tool pprof ./yourbinaryname localhost:/debug/pprof/profile
your can use help ,or top N to get top memory use function .
use "svg" or "web" to print detail information .and need graphviz
sudo yum install -y graphviz
or mac
brew install graphviz
if not generate svg ,down tar file and use this command to get svg ,after you can open svg in browser :
go tool pprof /Downloads/mv-w./pprof.xxx.localhost:.samples.cpu..pb
if you are in production mode:
just use wget :
wget http://localhost:9181/debug/pprof/heap
wget http://localhost:9181/debug/pprof/profile?seconds=100 -O profile-pprof #then you can sz files to local and generate svg or png
go tool pprof heap
go tool pprof profile-pprof then input svg/png/help;
golang pprof 内存分析的更多相关文章
- golang 性能优化分析:benchmark 结合 pprof
前面 2 篇 golang 性能优化分析系列文章: golang 性能优化分析工具 pprof (上) golang 性能优化分析工具 pprof (下) 一.基准测试 benchmark 简介 在 ...
- 记一次golang的内存泄露
程序功能 此程序的主要功能是将文件中数据导入到clickhouse数据库中. [问题描述] 服务器内存每隔一段时间会耗尽 [问题分析] 由于使用的是go语言开发的,所以采用了业界流行的工具pprof. ...
- Golang 的内存管理(上篇)
Golang 的内存管理基于 tcmalloc,可以说起点挺高的.但是 Golang 在实现的时候还做了很多优化,我们下面通过源码来看一下 Golang 的内存管理实现.下面的源码分析基于 go1.8 ...
- 深入理解golang:内存分配原理
一.Linux系统内存 在说明golang内存分配之前,先了解下Linux系统内存相关的基础知识,有助于理解golang内存分配原理. 1.1 虚拟内存技术 在早期内存管理中,如果程序太大,超过了空闲 ...
- iOS app内存分析套路
iOS app内存分析套路 Xcode下查看app内存使用情况有2中方法: Navigator导航栏中的Debug navigator中的Memory Instruments 一.Debug navi ...
- 【Android端 APP 内存分析】使用工具进行APP的内存分析
Android端可以通过adb 命令直接获取内存信息,当然Android studio也提供了对内存的监控分析工具,并且后续可以结合MAT做分析 今天介绍的是通过Android studio和MAT工 ...
- Chrome开发者工具之JavaScript内存分析
阅读目录 对象大小(Object sizes) 对象的占用总内存树 支配对象(Dominators) V8介绍 Chrome 任务管理器 通过DevTools Timeline来定位内存问题 内存回收 ...
- Eclipse CDT Linux下内存分析 补记
常用工具汇总 http://www.ibm.com/developerworks/cn/linux/l-cn-memleak/ 常用的内存分析工具 http://en.wikipedia.org/wi ...
- c中的进制与内存分析
一. 进制 1. 什么是进制 l 是一种计数的方式,数值的表示形式 数一下方块的个数 汉字:十一 十进制:11 二进制:1011 八进制:13 l 多种进制:十进制.二进制.八进制.十六进制. ...
随机推荐
- 泛型算法,排序的相关操作,lower_bound、upper_bound、equal_range
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- 自定义String
// ShStringNew.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> #inclu ...
- angular自定义指令
1.在directive文件下创建指令的js文件 通常自定义指令需要声明模块(注意定义指令时, js内部指令名称需采用 aaAaBb驼峰的命名方式 html中使用的是aa-aa-bb) e.g (f ...
- Android开发 ---Fragment片段布局
前言 Fragment想必大家不陌生吧,在日常开发中,对于Fragment的使用也很频繁,现在主流的APP中,基本的架构也都是一个主页,然后每个Tab项用Fragment做布局,不同选项做切换,使用起 ...
- 数位DP详解
算法使用范围 在一个区间里面求有多少个满足题目所给的约束条件的数,约束条件必须与数自身的属性有关 下面用kuangbin数位dp的题来介绍 例题 不要62 题意:在一个区间里面求出有多少个不含4和6 ...
- Codeforces Round #506 (Div. 3) D. Concatenated Multiples
D. Concatenated Multiples You are given an array aa, consisting of nn positive integers. Let's call ...
- __autolaod
转载自:https://blog.csdn.net/baidu_30000217/article/details/52743139 php实现类文件自动载入有两种办法: 魔术方法:__autoload ...
- 基于ArduinoLeonardo板子的BadUSB攻击实战
0X00 前言 在Freebuf上许多同学已经对HID攻击谈了自己的看法,如维克斯同学的<利用Arduino快速制作Teensy BadUSB>无论从科普还是实践都给我们详尽的描述了Bad ...
- Day15作业及默写
1.整理今天内容 PASS 2.现有列表alist = [3,1,-4,2,-6] 按照元素的绝对值大小进行排序 alist = [3,1,-4,2,-6] sorted(alist,key=lamb ...
- Collection集合复习方法回顾
Collection集合方法: add() //添加元素 remove() //移除元素 size() //返回集合长度 ...