stevedlawrence commented on a change in pull request #331: Fix deep stack sizes 
when serializing some schemas
URL: https://github.com/apache/incubator-daffodil/pull/331#discussion_r389774383
 
 

 ##########
 File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/CompiledExpression1.scala
 ##########
 @@ -212,7 +212,48 @@ class DPathCompileInfo(
   extends ImplementsThrowsSDE with PreSerialization
   with HasSchemaFileLocation {
 
+
+  /**
+   * This "parents" val is a backpointer to all DPathCompileInfo's that
+   * reference this DPathCompileInfo. The problem with this is that when
+   * elements are shared, these backpointers create a highly connected graph
+   * that requires a large stack to serialize using the default java
+   * serialization as it jumps around parents and children. To avoid this large
+   * stack requirement, we make the parents backpointer transient. This
+   * prevents jumping back up to parents during serialization and results in
+   * only needing a stack depth relative to the schema depth. Once all that
+   * serialization is completed and all the DPathCompileInfo's are serialized,
+   * we then manually traverse all the DPathCompileInfo's again and serialize
+   * the parent sequences (via the serailizeParents method). Because all the
+   * DPathCompileInfo's are already serialized, this just serializes the
+   * Sequence objects and the stack depth is again relative to the schema
+   * depth.
+   */
+  @transient
   lazy val parents = parentsArg
 
 Review comment:
   Correct. Will fix.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to