---
title: "一个内存泄漏，和一个mysql jdbc 驱动的问题"
author: "stephen80"
date: "2009-03-16T18:51:44Z"
tags: ["JDBC", "MySQL", "Tomcat"]
slug: "mysql-jdbc"
draft: false
lastmod: "2009-03-16T18:51:44Z"
id: 349981
url: "https://stephen80.iteye.com/blog/349981"
---

1. inputstream 没有关闭 ，或者其他引起的
解决办法：
 用 jprofiler, hot allocated , difference view 找到 分配的method
 fix it.

2.mysql ,jdbc 驱动， cacellation timer 不能被回收 ，导致泄漏。
   
  这个是,tomcat ,drivermanaged datasource启动多次后，内存泄露的原因。
  问题在于， hosspot 把 static 分配的timer 放到 perGen。

 解决办法：
  呵呵，没有解决。
  用 System.exit(1).强制程序退出。

