Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1867

AllJsIFrameVersioner causes large memory allocation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.5.0-beta4
    • 2.5.0, 2.5.0-beta5
    • Java
    • None

    Description

      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.

      Attachments

        1. JIRA1867.patch
          3 kB
          Marshall Shi

        Activity

          People

            Unassigned Unassigned
            marshall_601 Marshall Shi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 4h
                4h
                Remaining:
                Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified