All, I've been doing some profiling looking for wasted memory in my webapp and I've discovered that org.apache.velocity.runtime.parser.Parser contains a few members that appear to be (essentially) duplicates.
First, there is the "velocharstream" member which is a VelocityCharStream. Then, there is also a token_source member which is a ParserTokenManager which has a separate VelocityCharStream ("velcharstream" member). YourKit reports that these two are distinct objects, and they don't appear to share anything so I think they really are distinct. Each VelocityCharStream has a pair of 4096-byte buffers ("bufcolumn" and "bufline") plus a 8192-byte buffer in the "inputStream" member (a java.io.InputStreamReader), so each Parser is currently eating up 16k of memory in buffers. Yes, I know it's really nothing, but I'm wondering if buffers (or streams) are being allocated when they don't need to be allocated. Does anyone know why there might be two separate VelocityCharStreams at the Parser level? How about the 2 bufline/bufcolumn buffers in VelocityCharStream as well as the 8192-byte InputStreamReader buffer? The code has no inline documentation of Javadoc to suggest the purpose of these members. Thanks, -chris
signature.asc
Description: OpenPGP digital signature