ICEpdf
  1. ICEpdf
  2. PDF-68

Resources reference counting

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1.1, 4.0 - Beta, 4.0
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      none

      Description

      Resources objects are used by Page, PageTree, Form, ContentParser. Multiple Page objects can share the same Resources object, meaning that the first Page can initialise the Resource object, and then when loading the second Page (in a low memory scenario), it may run out of memory, and ask the MemoryManager to free memory, which will cause the first Page to dispose, which will dispose the shared Resources, while the second Page is trying to make use of it. In that scenario we want to avoid disposing the Resources.

      On the other hand, Form and ContentParser objects can temporarily make use of Resources objects, to create Shapes objects, which get passed up the stack to a Page object. When the ContentParser parses the input stream, and generates Shapes, if it made some of the Shapes via a Form, then it leaves that Form intact, and doesn't reclaim its memory. Which makes sense, since it can't dispose of the Shapes, since it's passing them up to whoever invoked its parse() method. Later, if we dispose of the Page, and re-init it, the ContentParser will lookup that Form again, and find it already initialized from before, since there is no hook to cleaning up a Form from within a ContentParser. In this case, we want to immediately cleanup the Resources from the Form.

      Both scenarios benefit from reference counting on the Resources objects, to better manage deferring or immediately cleaning up the Resources.

        Activity

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Patrick Corless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: