Anything's possible. :-) But like I said, I hope to eliminate the pool altogether.
So in the future, if you fail to end transactions properly, your database will complain, iBATIS won't. Clinton On 3/6/07, Abdullah Kauchali <[EMAIL PROTECTED]> wrote:
Notwithstanding the OP's issue … is there any sensible way of preventing this? Ie. how to detect connections are being returned to the pool without them properly ending transactions? Is it even possible? *From:* Clinton Begin [mailto:[EMAIL PROTECTED] *Sent:* Tuesday, March 06, 2007 6:40 PM *To:* [email protected] *Subject:* Re: What is RequestScope used for? Yep, you have a leak and it is RequestScope related...but it's likely not an ibatis bug... It's more likely that you're not ending transactions properly. try { sqlMapClient.startTransaction(); ///... do work } finally { sqlMapClient.endTransaction(); } Clinton On 3/6/07, *Kalcevich, Daniel* < [EMAIL PROTECTED]> wrote: OK, upon looking at the Yourkit, I am showing the number of objects in memory as the following: - com.ibatis.sqlmap.engine.impl.SqlMapClientImpl – 212 objects with a total retained size in memory of 31.38MB - com.ibatis.sqlmap.engine.scope.RequestScope – 108, 544 objects with a total retained size in memory of 16.49MB. - com.ibatis.sqlmap.engine.scope.SessionScope – 27,136 objects with a total retained size in memory of 3.03 MB. Do those numbers make sense? I only question it because with every snapshot of the memory I have taken along the way, the RequestScope/SessionScope objects keep increasing. Daniel ------------------------------ *From:* Kalcevich, Daniel *Sent:* Tuesday, March 06, 2007 7:04 AM *To:* '[email protected]' *Subject:* RE: What is RequestScope used for? I found about this RequestScope through the profiler YourKit. Here is the trail that references the IBatis objects. map of com.ibatis.sqlmap.engine.scope.RequestScope --[121] of java.lang.Object[513] ---elementData of java.util.ArrayList ----list of java.util.Collections$SynchronizedRandomAccessList -----pool of com.ibatis.common.util.ThrottledPool ------requestPool of com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te ------delegate of com.ibatis.sqlmap.engine.impl.SqlMapClientImpl -------client of com.ibatis.dao.engine.transaction.sqlmap.SqlMapDaoTransactionManager --------transactionManager of com.ibatis.dao.engine.impl.DaoContext ---------[0] of java.lang.Object[11] ----------elementData of java.util.ArrayList -----------value of java.lang.ThreadLocal$ThreadLocalMap$Entry ------------[1442] of java.lang.ThreadLocal$ThreadLocalMap$Entry[2049] -------------table of java.lang.ThreadLocal$ThreadLocalMap --------------threadLocals of java.lang.Thread [Stack Local, Thread] The reason I thought it might be contributing to a memory leak was the fact that at every snapshot I take, the number of HashMaps continues to increase without going down. Then when I look at what it is referring to, it points to the RequestScope. While looking in the trace, I saw that it was referencing the DaoContext's transaction Manager. Could the Transaction Manager be playing a part in this? My application uses Spring with SQL Maps, but a library we wrote uses the DAO Framework specifically. The Spring application does not use it. I think that is worth looking into, given what I see in the profiler. Daniel ------------------------------ *From:* Kalcevich, Daniel *Sent:* Monday, March 05, 2007 11:37 AM *To:* '[email protected]' *Subject:* What is RequestScope used for? Hello, I have a Spring, Struts, SQL Map application that runs on JBoss/Tomcat. And while going through a profiler, I am seeing that there are several instances of "com.ibatis.sqlmap.engine.scope.RequestScope". What is that object used for? The reason I ask is that I am trying to track down a memory leak and am wondering if this class is possibly part of the cause? Any help is greatly appreciated. Thank you. Daniel
