docling-project / docling-project/docling

Memory leak occurs when formula enrichment is enabled

Open
#1,886 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug
Whenever `do_formula_enrichment` is set to `True` in `PdfPipelineOptions`, the `DocumentConverter` instance causes a 100% memory usage. Whenever it is set to `False`, the conversion is successful.

The files I use are short instructional materials with little to moderate amounts of formulas. These are never more than 500KB big.

I can't get any logs as the terminal simply closes. I attempted to write errors through a try-except block wrapped around the conversion logic, but it does not work.

### Steps to reproduce
1. Simply run the following script
```python
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.datamodel.base_models import InputFormat

# define pipeline options
pipeline_options = PdfPipelineOptions()
pipeline_options.do_picture_description = True

# define converter object
converter = DocumentConverter(format_options={
InputFormat.PDF: PdfFormatOption(
pipeline_options=pipeline_options
)
})

# handle file
result = converter.convert(souce=, input_format=InputFormat.PDF)

# export markdown text
text = result.document.export_to_markdown()
```

### Docling version
Docling version: 2.39.0
Docling Core version: 2.39.0
Docling IBM Models version: 3.4.4
Docling Parse version: 4.1.0
Python: cpython-313 (3.13.3)
Platform: Linux-6.14.6-300.fc42.x86_64-x86_64-with-glibc2.41

### Python version
Python 3.13.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.