I would recommend that you don't use the singleton pattern. Create a new VelocityEngine instance for each invokation. For this type of work it is quite light weight.
regards Malcolm Edgar On 11/1/07, Sylvain Roche <[EMAIL PROTECTED]> wrote: > > Hi > > while unit testing my project, I encountered an out of memory > problem. More than 100 test methods resulted in an init call on a > VelocityEngine > After more or less 35 correct executions, all the next tests launch > an OutOfMemoryError - heap overflow > I googled for it, and it seems to be a know problem. > > Actually for me the thing is not to find a way to run my tests. The > problem is that the application I'm working on is a generic > application, made to run many clients. I'm using velocity to make > html mail templates, and each client has to have his own templates, > which all are in separate directories. That's why I didn't choose the > singleton Velocity pattern. > > So even if the error I deal with right now is about the number of > tests I'm running, it's nonetheless symptomatic of a limitation I > will encounter later. > > Is there a known good pattern which would meet my constraints ? > > One thing I don't understand is why do I have a OutOfMemoryError. > Each VelocityEngine is created by a test case. Shouldn't they be > cleanly destroyed at the end of the test case ? And then why would > that make an overflow if it was correct ? > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >