How does limit/release memory from Libreoffice programicly (PyUNO)?

I’m running Libreoffice in headless mode, and using Python + PyUNO to control it, (pyoo)
open .ods file (~7MB) with Calc, it easily occupied over 1GB RAM, and it won’t been release even I close the file.
Does there’re any way to limit memory usage or release RAM without close the process?
The version of Libreoffice is 7.4.7.2 40(Build:2).

For limit approach,I had tried JAVA_TOOL_OPTIONS="-Xmx1m" or put

<item oor:path="/org.openoffice.Office.Common/Cache/DrawingEngine"><prop oor:name="OLE_Objects" oor:op="fuse"><value>10</value></prop></item>
<item oor:path="/org.openoffice.Office.Common/Cache/GraphicManager"><prop oor:name="GraphicAllowedIdleTime" oor:op="fuse"><value>1</value></prop></item>
<item oor:path="/org.openoffice.Office.Common/Cache/GraphicManager"><prop oor:name="GraphicMemoryLimit" oor:op="fuse"><value>65536</value></prop></item>

in ~/.config/libreoffice/4/user/registrymodifications.xcu
they are not working.

More context:
I wrap up Libreoffice and FastAPI as HTTP server in image, and deploy it to Cloud Run,
the memory can’t release and finally reach limit value in Cloud Run, the service would be kill by Goggle, the service would open multiple file for multiple user, so I need a way to release memory without kill the process.
Also because it’s running in container, so some approach to limit memory can’t be used in the condition.

core being in c++, logical this has no effect.
for the gory details : Development/How to debug - The Document Foundation Wiki #Valgrinding

VIRT ? RES ?

you can have several running, and implement a pool you can monitor.