[ 
https://issues.apache.org/jira/browse/VELOCITY-570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12622581#action_12622581
 ] 

Jarkko Viinamäki commented on VELOCITY-570:
-------------------------------------------

I can confirm that the current SVN head contains a bug which can be fixed by 
the patch Jacob submitted. The bug is critical and causes OutOfMemory error 
when a large template is parsed a couple of times (with caching off):

Running org.apache.velocity.test.issues.RepeatedParsingTest
iteration: 0
iteration: 1
java.lang.OutOfMemoryError: Java heap space
        at 
org.apache.velocity.runtime.parser.VelocityCharStream.ExpandBuff(VelocityCharStream.java:
67)
        at 
org.apache.velocity.runtime.parser.VelocityCharStream.FillBuff(VelocityCharStream.java:13
1)
        at 
org.apache.velocity.runtime.parser.VelocityCharStream.readChar(VelocityCharStream.java:24
6)
        at 
org.apache.velocity.runtime.parser.ParserTokenManager.jjMoveNfa_3(ParserTokenManager.java
:2160)

> speed improvement of the tokenizer
> ----------------------------------
>
>                 Key: VELOCITY-570
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-570
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.4, 1.5, 1.6
>         Environment: Tested on FreeBSD 6.2-STABLE and Linux (Debian Etch) on 
> i386.
> Java: JDK 1.5
>            Reporter: Ronald Klop
>             Fix For: 1.6
>
>         Attachments: expandbuff-speedup-reinit-fix.patch, 
> expandbuff-speedup.patch
>
>
> On some large templates (1-4MB) velocity gets very slow. I used JProfiler and 
> found a lot of time is spent in VelocityCharStream.ExpandBuff. It is doing a 
> lot of System.arraycopy.
> The problem is that the size of the buffer is increased linearly in stead of 
> exponentialy.
> I have made a patch which doubles the size of the buffer in stead of 
> incrementing it with the same value.
> In my tests and in JProfiler it is shown that a lot less time is spent in 
> ExpandBuff.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to