Environment
- PaddleOCR version: 3.4.1
- PaddlePaddle version: 3.3.1
- Python: 3.12
- OS: Ubuntu 24.04 (Docker container)
- Device: CPU only (
enable_mkldnn=False)
What happens
Calling PaddleOCR(lang='german', enable_mkldnn=False).predict(image_path) on a scanned document image causes the process to allocate ~43 GB of anonymous RSS and be killed by the Linux OOM killer.
Kernel log:
Out of memory: Killed process 132564 (uvicorn) total-vm:51828452kB, anon-rss:43528356kB, file-rss:1536kB
This happens on every real inference call. The process had successfully downloaded the model files (latin_PP-OCRv5_mobile_rec) and completed TIFF→PNG conversion before the OOM kill occurred during predict().
Reproduction
from PIL import Image
import tempfile, pathlib
from paddleocr import PaddleOCR
with tempfile.TemporaryDirectory() as d:
p = pathlib.Path(d) / "test.png"
Image.new("RGB", (800, 1000), (255, 255, 255)).save(str(p))
ocr = PaddleOCR(lang="german", enable_mkldnn=False)
result = ocr.predict(str(p)) # OOM kill here
Notes
- The same model instantiation without
predict() does not cause the issue (memory stays reasonable until inference starts)
enable_mkldnn=False was required because the default enable_mkldnn=True raised NotImplementedError: ConvertPirAttribute2RuntimeAttribute not support [pir::ArrayAttribute<pir::DoubleAttribute>] on this CPU
- PaddleOCR 2.x used ~1–2 GB for the same task; the ~43 GB usage in 3.x appears to be a regression
- Tested with both
lang='german' and lang='en' — both trigger the OOM
Expected behaviour
Memory usage during CPU inference should be in the range of 1–4 GB, consistent with PaddleOCR 2.x behaviour.
Environment
enable_mkldnn=False)What happens
Calling
PaddleOCR(lang='german', enable_mkldnn=False).predict(image_path)on a scanned document image causes the process to allocate ~43 GB of anonymous RSS and be killed by the Linux OOM killer.Kernel log:
This happens on every real inference call. The process had successfully downloaded the model files (
latin_PP-OCRv5_mobile_rec) and completed TIFF→PNG conversion before the OOM kill occurred duringpredict().Reproduction
Notes
predict()does not cause the issue (memory stays reasonable until inference starts)enable_mkldnn=Falsewas required because the defaultenable_mkldnn=TrueraisedNotImplementedError: ConvertPirAttribute2RuntimeAttribute not support [pir::ArrayAttribute<pir::DoubleAttribute>]on this CPUlang='german'andlang='en'— both trigger the OOMExpected behaviour
Memory usage during CPU inference should be in the range of 1–4 GB, consistent with PaddleOCR 2.x behaviour.