The Chinese user is desperately asking for help to fix the memory leak issue
in DAS as their project is going to production soon. His investigation shows
the leak is from CommandImpl. The following line produces a lot of objects
that cannot be GCed.
XSDHelper.INSTANCE.define(inputStream, url.toString());
He uses a simple test case to show the issue:
1) Load the DAS config file (see below)
2) Use DASFactory to create DAS. No queries will be performed.
Can you help?
Thanks,
Raymond
--------------------------------------------------
From: "TJ" <tangg...@gmail.com>
Sent: Wednesday, July 29, 2009 12:51 AM
To: "Tuscany SCA 中文论坛" <tuscany-s...@googlegroups.com>
Subject: DAS框架内存泄露问题-急!
> Raymond Feng,你好!
> DAS内存泄漏已经困扰我们久的时间了,起初我一直认为DAS将会有更新的版本推出,所以一直没有在意。但开发将近一年的时间了,DAS仍没有任何新版
> 本推出,项目马上就到发布时间了,但对内存泄漏的问题,我们也还未找到解决的办法。
>
> 前一阵子,我通过JProfile工具对项目进行了跟踪,总算是有所发现,现在可以肯定的是泄漏是从
> org.apache.tuscany.das.rdb.impl.CommandImpl类的构造方法开始的,
> 构造方法代码如下:
> public CommandImpl(String sqlString) {
> statement = new Statement(sqlString);
>
> try {
> URL url = getClass().getResource("/xml/sdoJava.xsd");
> if (url == null) {
> throw new RuntimeException("Could not find resource:
> xml/sdoJava.xsd");
> }
>
> InputStream inputStream = url.openStream();
> XSDHelper.INSTANCE.define(inputStream, url.toString());
> inputStream.close();
> } catch (IOException ex) {
> throw new RuntimeException(ex);
> }
>
> }
> 其中:程序一旦调用了 XSDHelper.INSTANCE.define(inputStream,
> url.toString());这段代码,
> 就会产生很多无法回收的对象,并且内存是以锯齿状增长,增长速度是兆级。一般情况下,我只要调用CommandImpl的构造函数400次,内存就会涨
> 到几百兆。可见泄漏是相当严重的。
> 我的测试方法也很简单,步骤如下:
> 1、加载DAS的Config文件,Config文件内容例如:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd
> config.xsd">
>
> <Command kind="Select" name="getTableStruct" SQL="SELECT * FROM
> XXX" />
> <Command kind="Update" name="getCanteenById" SQL="UPDATE XXX"/>
>
> <Table tableName="XXX" typeName="xxx">
> <Column columnName="CO1" propertyName="co1" primaryKey="true"/
>>
> <Column columnName="CO2" propertyName="co2" primaryKey="true"/
>>
> <Column columnName="CO3" propertyName="co3"/>
> <Column columnName="CO4" propertyName="co4"/>
> </Table>
>
> <Relationship/>
> <ConnectionInfo/>
> </Config>
> 2、通过DASFactory创建DAS。
> 就两步,没有执行任何数据查询。
>
> 请 Raymond Feng 帮帮忙,找到相关的人员帮忙解决,谢谢啦!
> >
>
2009/7/29 Raymond Feng <enjo...@gmail.com>:
--
Luciano Resende
Apache Tuscany, Apache PhotArk
http://people.apache.org/~lresende
http://lresende.blogspot.com/