Skip to content

Incorrect Memory Leak Reporting #482

@orenbahari

Description

@orenbahari

I am getting a ton of warnings in the engine, when I provide my logger to check if something is wrong with the engine itself.

[PDFiumEngine:MemoryManager][warn] Potential memory leak: 1 unfreed allocations. { args: ['Potential memory leak: 1 unfreed allocations'] category: "MemoryManager", source: "PDFiumEngine"} [PDFiumEngine:MemoryManager][warn] - 1781008: 1605652 bytes

The 1,605,652-byte allocation is the PDF file buffer loaded into WASM heap memory via memoryManager.malloc(length) in PdfiumNative.openDocumentBuffer() (direct-engine line 1068), seen here:

const filePtr = this.memoryManager.malloc(length); // 1,605,652 bytes = your PDF
this.pdfiumModule.pdfium.HEAPU8.set(array, filePtr);
const docPtr = this.pdfiumModule.FPDF_LoadMemDocument(filePtr, length, password);

This is not a memory issue and is freed if you destroy the document/engine. To solve this you have to ignore logging, which is bad.

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