velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Configuring number of parsers and buffer sizes
Date Fri, 27 Apr 2012 00:59:15 GMT

I've been looking at the docs for both Velocity Tools and Velocity
itself and I can't seem to find out what the properties are for
controlling the number of template parsers to create and how big their
buffer sizes are.

I've been doing some memory profiling of my webapp and it looks like
Velocity is keeping some rather large (and empty -- probably because
they haven't yet been used) buffers for parsing.

I can see a bunch (76) of int[4096] arrays within VelocityCharStream
(the class member is 'bufline'), and I can also see buried in
VelocityCharStream which uses an InputStreamReader ('inputStream') a
byte[8192] which appears to exist 48 separate times.

So, the total "wasted" space due to these two arrays (duplicated a bunch
of times) is, on the face of it, small: it's like 1-2MiB. On the other
hand, if I don't need all that buffer space, I'd like to remove it.

So, first: how can I configure the number of parsers and possibly the
buffer sizes used by them?

Second: is VelocityCharStream essentially double-buffering since the
InputStreamReader seems to have a large buffer inside it and also
VelocityCharStream has its own buffer?


View raw message