Hi,

today JavaCC works fine - maybe there was bad day ;)

I run profiler with simple velocity app (2 .vm file, simple merge) and found
that internal by design CharStream has method :
---
 /**
  * The lexer calls this function to indicate that it is done with the
stream
  * and hence implementations can free any resources held by this class.
  * Again, the body of this function can be just empty and it will not
  * affect the lexer's operation.
  */
 void Done();
--
but this method is never called by any JavaCC code (lexer/parser).
In class VelocityCharStream.Done()  implementation buffers are cleaned.

More, in VelocityCharStream constructor we have 3 times allocation of 4kb
buffer
   buffer = new char[buffersize];
   bufline = new int[buffersize];
   bufcolumn = new int[buffersize];

And in class Parser constructor we create 2 times VelocityCharStream.
So every Parser allocates about 24kb memory, even when is not needed.

When I run trace I can find that memory is deallocated from old tempate only
on new parse request, but only to this 24kb.
In Done method we can also null readerStreem.

Mayby this will help improve memory management.

Sylwester




2007/3/12, Will Glass-Husain <[EMAIL PROTECTED]>:

Hi Sylvester,

Thanks for the note on the build script.  It really needs to check for
a min of 1.6.

I'm not sure why you have problems compiling.  I use javacc 3.2 as
well.  Did you type "ant clean" first?

JavaCC generates node files and Parser.java.  The node files are not
needed and can be deleted.  (I think this happens in the build
script).  If you are just changing existing syntax, no manual copying
of files is required.  If you are adding a new Node you'll have to
move that into the Node directory.

WILL



Reply via email to