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

        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19624 Thu Nov 05 14:09:35 MST 2009 patrick.corless PDF-68 - merged resource initialization changes back into the trunk.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/Dictionary.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/util/ContentParser.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/Resources.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/PageTree.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/Form.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/Page.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/graphics/TilingPattern.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/util/Library.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/graphics/Shapes.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19617 Thu Nov 05 10:46:55 MST 2009 patrick.corless PDF-68 fixes reinitialization issue with form objects that are shared resources.
        Files Changed
        Commit graph MODIFY /icepdf/branches/icepdf-3.1.0/icepdf/core/src/org/icepdf/core/pobjects/graphics/Shapes.java
        Commit graph MODIFY /icepdf/branches/icepdf-3.1.0/icepdf/core/src/org/icepdf/core/util/ContentParser.java
        Commit graph MODIFY /icepdf/branches/icepdf-3.1.0/icepdf/core/src/org/icepdf/core/pobjects/Resources.java
        Commit graph MODIFY /icepdf/branches/icepdf-3.1.0/icepdf/core/src/org/icepdf/core/pobjects/PageTree.java
        Commit graph MODIFY /icepdf/branches/icepdf-3.1.0/icepdf/core/src/org/icepdf/core/pobjects/Page.java
        Commit graph MODIFY /icepdf/branches/icepdf-3.1.0/icepdf/core/src/org/icepdf/core/pobjects/Form.java

          People

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

            Dates

            • Created:
              Updated:
              Resolved: