Hi! We have been doing some memory-profiling of our site. And found a issue with the class com.opensymphony.oscache.web.filter.RepsonseContent
<a href="
https://xwork.dev.java.net/source/browse/oscache/src/java/com/opensymphony/oscache/web/filter/ResponseContent.java?rev=1.1&view=auto&content-type=text/vnd.viewcvs-markup" >com.opensymphony.oscache.web.filter.RepsonseContent</a>.
The issue involves the field named 'bout' declared thus:
private transient ByteArrayOutputStream bout = new ByteArrayOutputStream(1000);
private Locale locale = null;
private String contentEncoding = null;
private String contentType = null;
private byte[] content = null;
private long lastModified = -1;
'bout' will after a call hold the cached content. It will also be in the field 'content'. 'bout' is transient but that will not help until we do a restart of the jvm.
I propose that on commit the filed 'bout' be cleared something like this:
/**
* Called once the response has been written in its entirety. This
* method commits the response output stream by converting the output
* stream into a byte array.
*/
public void commit() {
content = bout.toByteArray();
bout=null; //<---- New code
}
This will in affect half the memory consumption of cached objects!
By the way we used the Yourkit Java profiler it is a great product!
/Konstantin
PS If you want to I can submit a patch or try out the change and make sure it works!