Marshall Shi created SHINDIG-1867:
-------------------------------------

             Summary: AllJsIFrameVersioner causes large memory allocation
                 Key: SHINDIG-1867
                 URL: https://issues.apache.org/jira/browse/SHINDIG-1867
             Project: Shindig
          Issue Type: Bug
          Components: Java
    Affects Versions: 2.5.0-beta4
            Reporter: Marshall Shi


The AllJsIframeVersioner causes a massive memory allocation executing the 
following:

StringBuilder jsBuf = new StringBuilder();
for (FeatureResource resource : registry.getAllFeatures().getResources()) {
 jsBuf.append(resource.getContent()).append(resource.getDebugContent());
 }
 this.allJsChecksum = HashUtil.checksum(jsBuf.toString().getBytes());
 
The two problems with this are:
(1) Creates a massive char[] for that string (we tested with a 4M resource)
(2) Then allocates a new byte[] for that giant string

Proposed solution is to just use a simple message digest object against each 
resource content. And concat all the bytes for HashUtil.checksum.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to