mbeckerle commented on pull request #437:
URL: 
https://github.com/apache/incubator-daffodil/pull/437#issuecomment-710086512


   How about a test mode? A settable flag in pstate/ustate and a mutable list.
   
   Instead of just nilling the refs to things being released when the flag is 
set you also push them onto the list. At end of a test run we inspect the list 
to insure the right things have been put on the list?
   
   Seems like small effort for a big increase in testability maintainability of 
this feature. Could be done for both parse and unparse.
   
   ________________________________
   From: Steve Lawrence <[email protected]>
   Sent: Friday, October 16, 2020 9:54:04 AM
   To: apache/incubator-daffodil <[email protected]>
   Cc: Beckerle, Mike <[email protected]>; Comment 
<[email protected]>
   Subject: Re: [apache/incubator-daffodil] Free infoset element during unparse 
(#437)
   
   
   @stevedlawrence commented on this pull request.
   
   ________________________________
   
   In 
daffodil-core/src/test/scala/org/apache/daffodil/infoset/TestInfoset.scala<https://github.com/apache/incubator-daffodil/pull/437#discussion_r506448616>:
   
   >     */
      def testInfoset(testSchema: scala.xml.Elem, infosetAsXML: 
scala.xml.Elem): (DIElement, Root, DaffodilTunables) = {
   -    val schemaCompiler = 
Compiler().withTunable("allowExternalPathExpressions", "true")
   +    val schemaCompiler =
   +      Compiler()
   +        .withTunable("allowExternalPathExpressions", "true")
   +        .withTunable("releaseUnneededInfoset", "false")
   
   
   It's actually kindof hard to write a test to make sure everything is getting 
cleaned up appropriately. At the end of unparsing, the DIDocument should have a 
single child, the root element. If that root element isn't used in an 
expression it should get set to null. So at the end of a parse, the DIDocument 
child(0) should be null if not used in an expression. But that only tests that 
we were able to free the root element. It's possible things were broken so that 
no a single other element was freed and the only thing actually freed was the 
root element. And since the root elemen was freed, there's no way to know if 
any of it's children were freed--we no longer have any access to it or it's 
children.
   
   Maybe the best way to ensure this is working correctly is to just develop 
tests that would fail with OutOfMemory errors if we weren't cleaning up infoset 
correctly. Those tests would likely be too large/take too long to keep in the 
Daffodil repo, but I believe @dfthompson<https://github.com/dfthompson> is 
working on some tests that live in Owl's internal test infrastructure. Once 
those are done, we might want to find a place where those can be made public so 
others can test them.
   
   —
   You are receiving this because you commented.
   Reply to this email directly, view it on 
GitHub<https://github.com/apache/incubator-daffodil/pull/437#discussion_r506448616>,
 or 
unsubscribe<https://github.com/notifications/unsubscribe-auth/AALUDA3C6CIZTTQYZQ7JQEDSLBF7ZANCNFSM4SSADTDQ>.
   


----------------------------------------------------------------
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]


Reply via email to