Skip to content

libpdfium.so GC error #47

Open
Open

Description

@littlehorse417

Version

pdftext==0.6.3
pypdfium2==4.30.0

Problem

The Python garbage collector is collecting TextPage objects while PDFium internally cleans up CPDF_TextPage resources, both accessing the same memory region and leading to a race condition.

Thought

https://github.com/datalab-to/pdftext/blob/master/pdftext/pdf/pages.py#L277-L289

Can we manually call textpage.close() to release resources after using the TextPage object?

Activity

  1. littlehorse417 commented on Jun 20, 2025

    @littlehorse417
    Author

    Can we upgrade pypdfium2 to 4.30.1?
    https://github.com/pypdfium2-team/pypdfium2/blob/4.30.1/docs/devel/changelog.md

    4.30.1 Changelog

    PdfPage.get_objects(): Don't register pageobjects as children, because they don't need to be closed by the caller when part of a page. This avoids excessive caching of weakrefs that are not cleaned up with the object they refer to.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions