runtime.parser.Parser maintains multiple VelocityCharStreams?

Christopher Schultz <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
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 (application/pgp-signature, 946 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRaEdHAAoJEBzwKT+lPKRYLZEP/R8plQKVS19gkh5pD5hBY9QA
2JLA/27NSxG6EeHnY6TJNHKr9DV8x7oF0y6UFTgw+Vnpvm7+IrBfe87jGPXXS0b2
RYHIi/E4ezAGnyyghpARVnCNZRXatdutcdsVGOK1Ceyyfrjz33tWDFGeS4vqA88K
mew4rLw1n1ApHRNqdFLIY9BhXVIfudYGbI4u2tqw/PWsn8apKR51bXWRLJBstNDs
KQL58FUdrZOBTF3VXZzaLjSPItBVBSRvDwFBTKSLWsVMIHN3LgUnXsRtnmFXRl4m
+MaaiChOrwAgEUt/ccj2zF/F7+4cDBBMQ6K1Sk2vSqct31NFQLzN5hH4MHBiqkaW
UlcoCOUG/x912QGoIeOfG0WM9vuOGoqOXdY/RvS83bhMWOvJeVXwT3cVi9FfeLws
BT0SOcWwgbRraPexaFMm6k0EALZLQK+QPI2sKyMLAWq3xKoYZi7Qpg/A6nnm6dQ9
cXWDcvoWlbUjvcuYcnAwIBZh03kIurJH5nqzQR8rKr4uSfMTlI133exR4pGa0082
zuiTXvD4YbxWd8PSdH9YT1VZl+22rtvxFjpS1TZLEvsA/t05OugkNf2Gm16veqMm
YUBRCaluNKSqxdzrR22FbBkOET64ePT2FugVKUXSE0YHL17gpYceJpUJ4bf02lWD
hJhABpeb/xQnCFm0tKFW
=Oy1a
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.