---
title: "Cobar内存快速检测tips"
author: "BucketLi"
date: "2017-11-07T17:20:31Z"
tags: []
categories: ["开源软件"]
slug: "cobar-tips"
draft: false
lastmod: "2017-11-07T17:27:43Z"
id: 2398943
url: "https://bucketli.iteye.com/blog/2398943"
---

很长时间没有使用mat,技巧生疏，趁这次使用Cobar（https://github.com/alibaba/cobar）,排查一个fullgc问题，使用了一把，这边tips下。

1. 已经从出事机器上dump出来了内存文件并且下载到本地

2. 打开mat（如果文件较大，建议先调整下mat的jvm参数）

3. 加载分析...

4. 打开Histogram,并且按照Shallow Heap从大到小排序

5. 右击最大那一项->List objects->with incoming references
![](http://dl2.iteye.com/upload/attachment/0127/7214/480dcf6a-d62c-3065-aa23-48caccab3e44.png)

6. 按照Shallow Heap从大到小排序，得到结论：因为insert batch过大，并且有一定并发度，导致内存爆掉
![](http://dl2.iteye.com/upload/attachment/0127/7216/fba90128-08b0-3599-9d2b-4aafc9912725.png)