stevedlawrence commented on a change in pull request #460:
URL: https://github.com/apache/incubator-daffodil/pull/460#discussion_r532625868



##########
File path: 
daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
##########
@@ -200,20 +194,44 @@
             </xs:documentation>
           </xs:annotation>
         </xs:element>
-        <xs:element name="maxBinaryDecimalVirtualPoint" type="xs:int" 
default="200" minOccurs="0">
+        <xs:element name="maxBinaryDecimalVirtualPoint" default="200" 
minOccurs="0">
           <xs:annotation>
             <xs:documentation>
               The largest allowed value of the dfdl:binaryDecimalVirtualPoint 
property.
             </xs:documentation>
           </xs:annotation>
+          <xs:simpleType>
+            <xs:restriction base="xs:int">
+              <xs:minInclusive value="1" />
+            </xs:restriction>
+          </xs:simpleType>
+        </xs:element>
+        <xs:element name="maxByteArrayOutputStreamBufferSizeInBytes" 
default="2097152000" minOccurs="0">
+          <xs:annotation>
+            <xs:documentation>
+              When unparsing, this is the maximum size of the buffer that the
+              ByteArrayOutputStream can grow to before switching to a file 
based
+              output stream.
+            </xs:documentation>
+          </xs:annotation>
+          <xs:simpleType>
+            <xs:restriction base="xs:int">
+              <xs:minInclusive value="0" />
+            </xs:restriction>
+          </xs:simpleType>

Review comment:
       I think this field actually must have a max size of IntMax, so using a 
long was incorrect.
   
   This tunable sets the max size for an unparse buffer before we switch the 
buffer from memory based via a ByteArrayOutputStream to file based via a 
FileOutputStream. When the buffer is backed by a ByteArrayOutputStream, the max 
length must be IntMax since byte arrays can't be larger than an int. If we 
allowed this value to be a long, we could overfill the ByteArrayOutputStream 
instead of switching to a FileOutputStream and I think an exception will be 
thrown.
   
   I think zero is also a valid value for this tunable. When this value is 
zero, it just means that we'll always use a FileOutputStream for buffers and 
never use an in-memory byte array. Perhaps this could be useful on a system 
with extremely limited memory?




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