DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41057>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41057





------- Additional Comments From [EMAIL PROTECTED]  2006-11-29 06:36 -------
(In reply to comment #3)
> Ok, I understand the script I think. 

Yes, the script works exactly how You said. I created it just to isolate the
problem from my real app where I need to POST many large Strings (could be
megabytes). 

First, I don't understand why there is a need to cache request parameters for a
longer duration than it takes to process the request. It would be useful only in
very rare cases: if clients would make the exact same request many times.

Second, I could not confgure the cahce in a useful way. These are default 
StringCache settings in catalina.properties:

# String cache configuration.
tomcat.util.buf.StringCache.byte.enabled=true
#tomcat.util.buf.StringCache.char.enabled=true
#tomcat.util.buf.StringCache.trainThreshold=500000
#tomcat.util.buf.StringCache.cacheSize=5000

The byte cahce is enabled by default and the memrory leak occurs.

I tried to avoid the leak by trying different configurations and here is what I
discovered:

1) The leak does not appear if the byte cache is disabled
(...StringCache.byte.enabled=false). But disabled cache can't be useful at all.

2) I don't know what is the purpose of trainTreshold property, but that is the
only property that can help: setting it low enough (even extremely low) avoids
the leak. For example, lowering trainTreshold to 100 for 10kB requests avoids
the leak, but isn't that the same as disabling the cache?

3) Limiting the cache size does not work as expected - for example, with
cacheSize=1 the large requests still lead to exhaustion of heap memory. Digging
with Memory Leak Detector shows that _all_ the request parameters still stay in
heap, referenced by a static field in org.apache.tomcat.util.buf.StringCache.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to