echo ""; echo ""; echo ""; echo ""; if(!is_admin){echo "";} » 针对JDBC是否释放资源对内存的影响所做的实验 仲子说

2007-11-04

针对JDBC是否释放资源对内存的影响所做的实验

Posted in Java at 17:37 Author:仲远

标签:

??10?30?????????JDBC???????????????????????JDBC??Mysql?????Connection?Statement?Resultset???????????????????????????????????????????????????????????????????????????????????8???

(1)?????????Connection???conn?????????????????????????Statement s??Resultset rs: s.close();rs.close()?
?????????1.3G?????

  1. Mem: 92M Active, 29M Inact, 42M Wired, 88K Cache, 32M Buf, 1329M Free

?????????????????12M?????????????????????????12M???

  1. Mem: 104M Active, 29M Inact, 42M Wired, 88K Cache, 32M Buf, 1317M Free

?????????????????????

  1. Mem: 92M Active, 29M Inact, 42M Wired, 88K Cache, 32M Buf, 1329M Free

(2)?????????Connection???conn?????????????????????????Resultset rs: rs.close()??????Statement s???
?????????1.3G?????

  1. Mem: 92M Active, 29M Inact, 42M Wired, 88K Cache, 32M Buf, 1329M Free

??????????????????????????????????

  1. Mem: 92M Active, 29M Inact, 42M Wired, 88K Cache, 32M Buf, 1281M Free

??????????????????????

  1. Mem: 92M Active, 29M Inact, 42M Wired, 88K Cache, 32M Buf, 1329M Free

?????????????
???????????????????????????????????????????????“??”?????????????

????????????????????????????Connection?????????conn??????????Statement??????????????????????????????????????????(gc??Driver Vendor?????statement?resultset)?????????????????????????????Statement s??Resultset rs?????????(??????????????????????)?

????????????????????????????
?????http://www.wangzhongyuan.com/archives/231.html

本文可以自由转载,转载时请保留全文并注明出处:
转载自仲子说 [ http://www.wangzhongyuan.com/ ]
原文链接:

2 Comments »

  1. 使用JDBC后记得关闭并释放数据库连接资源噢:) 仲子说 Java, JDBC, JobTong, 内存溢出, 数据库连接 释放资源 said,

    2009年April29日 at 23:30

    […] 大家还可以查看我《针对JDBC是否释放资源对内存的影响所做的实验》。 […]

  2. WCF服务运行一段时间后客户端无法连接WCF服务的解决办法 仲子说 .NET 解决办法 said,

    2010年August10日 at 22:13

    […] 经过调试跟踪,最后发现网上有人也有遇到类似问题,产生原因为“We were creating instances of the Service Reference proxies to the WCF service but we never called Close() on the proxy. ”(我们在应用程序中创建了很多实例连接WCF服务,但是却从没有关闭这个连接)。由此可见,使用WCF服务,就如果使用数据库服务一样,打开连接后,要记得关闭噢(参见《使用JDBC后记得关闭并释放数据库连接资源噢:)》与《针对JDBC是否释放资源对内存的影响所做的实验》)。 […]

Leave a Comment

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word