[stringtemplate-interest] what is the use for embeddedInstances ?

Jax Law jax at ning.com
Mon Jun 2 14:48:16 PDT 2008


Hi,

In StringTemplate.java, what is the purpose of the LinkedList 
embeddedInstances ?
I've searched the source tree and there is no usage of this LinkedList. 
We've found
an obscure memory leak issue with embeddedInstances where the list has grown
to 10 million entries. The issue is that when 
StringTemplate.getInstanceOf() method
is called, the copy it returns is not a true deep copy. It has many 
references to the
original StringTemplate via the chunks Expr, StringTemplateAST ...etc. 
One of
these references is accessible to a write() method call stack and thus 
build up the
embeddedInstances LinkedList.

Since no usage can be found, I am assuming we can make addEmbeddedInstance
a No-Op in our own build ?

Thanks !

Jax



More information about the stringtemplate-interest mailing list