You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2013/04/12 19:41:24 UTC

runtime.parser.Parser maintains multiple VelocityCharStreams?

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


Re: runtime.parser.Parser maintains multiple VelocityCharStreams?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Nathan,

On 4/12/13 2:06 PM, Nathan Bubna wrote:
> I've no idea.  I've never really dug into those much.  If Jarkko is
> kicking around, he might know.

I'll give it a few days before I give it another bump.

Oh, and I totally forgot to mention that I was using Velocity 1.7.

Thanks,
-chris

> 
> On Fri, Apr 12, 2013 at 10:41 AM, Christopher Schultz
> <ch...@christopherschultz.net> wrote:
>> 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
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
> 


Re: runtime.parser.Parser maintains multiple VelocityCharStreams?

Posted by Nathan Bubna <nb...@gmail.com>.
I've no idea.  I've never really dug into those much.  If Jarkko is
kicking around, he might know.

On Fri, Apr 12, 2013 at 10:41 AM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> 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
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org