[Python] [Writer] Memory consumption?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
yijinger
Posts: 12
Joined: Fri Apr 02, 2021 8:00 am

[Python] [Writer] Memory consumption?

Post by yijinger »

Hi all,

I'm somewhat disturbed by how much RAM LibreOffice consumes while running in hidden mode. My script creates about 90 text documents (.odt files), writes them in a temporary folder, then compiles into one document. Source files are about 100-400 KB each, with some OLE objects in them, and the resulting document is about 5 MB. I also run automatic PDF export, and PDF is about 11 MB. LibreOffice (soffice.bin process as I see it in Gnome System Monitor) takes about 5 GB RAM for this task according to Linux system monitor, so I decided to look deeper. I run psutil.Process(office_pid).memory_info(), then show all dictionary members in a log. There are 7 of them: RSS, Data, Shared, Text, VMS, Lib and Dirty. Two first members show actually used pages, as I understand. VMS is just some system reserve for the process, so I do not care much about it. "Shared" increases to about 100 MB and remains at this level, while RSS and Data increase to 5,6 GB each! And I call doc.dispose() after I finish to work with each file, both source and result. The most mysterious increase happens after adding of page numbers: from 4GB to those 5,6 GB - just for numbering 140 pages with a single field.

The first question I want to ask: is it normal to take so much RAM? And if not, how these numbers can be decreased?
LibreOffice 6.0.7.3 on Linux Mint 20
Post Reply