[
https://issues.apache.org/jira/browse/DAFFODIL-1879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17086645#comment-17086645
]
Mike Beckerle commented on DAFFODIL-1879:
-----------------------------------------
A technique to fix this is using a Delay object which is roughly
{code:java}
case class Delay[T](value : => T){code}
Then you pass Delay objects to var parameters which can all be set null after
the values are retrieved.
The only advantage this has over @TransientParam, is that you can ask for the
value of all of these things, and then set the vars null even if you are NOT
going to serialize/deserialize the parser/unparser.
I'm not sure it's worth it though. You would have to set them null before
serializing also. It's one more thing to maintain.
> Compilation related data structures cannot be garbage collected due to
> RuntimeData strong references
> ----------------------------------------------------------------------------------------------------
>
> Key: DAFFODIL-1879
> URL: https://issues.apache.org/jira/browse/DAFFODIL-1879
> Project: Daffodil
> Issue Type: Bug
> Components: Back End, Front End
> Reporter: Steve Lawrence
> Assignee: Steve Lawrence
> Priority: Major
>
> All the *RuntimeData and DPathCompileInfo constructors accept pass-by-name
> parameters. Some of the arguments passed into these constructors reference
> objects that are only needed for schema compilation (e.g. dsom, grammar,
> etc.). Because they are pass by name, these objects are strong reference and
> thus cannot be garbage collected, leading to the entire compilation state
> being store in memory.
> Fortunately, those parameters are marked as transient and so when serialized
> and deserialized they are effectively garbage collected. But if one does not
> save/reload a schema, lots of wasted memory used during schema compilation
> will stick around. Pass-by-name parameters cannot be vars, so the simple
> thing of making them vars and then setting to null does not work. These
> objects should be restructured to allow them to be garbage collected once
> compiled.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)