§
    �Wêjq  ã                   ó   — d Z ddlZdd„ZdS )z:
common_util.py

Utils shared by the ONNX runtime users.

é    Nc                 ód   — t          j        ¦   «         }d|_        t          j        | ||¬¦  «        S )aG  
    Create an ort.InferenceSession with the CPU memory arena disabled.

    By default, ort.InferenceSession uses enable_cpu_mem_arena=True, which
    causes the ONNX Runtime allocator to retain the peak allocation across
    all calls and never release it back to the OS.  When a long-lived process
    processes many PDFs that differ in page size or element count, the arena
    grows without bound and is never reclaimed even after gc.collect().

    Setting enable_cpu_mem_arena=False makes the runtime release allocations
    promptly, keeping RSS stable across documents.
    F)Úsess_optionsÚ	providers)ÚortÚSessionOptionsÚenable_cpu_mem_arenaÚInferenceSession)Ú
model_pathr   Úsos      ú‘/Users/tedpeters/Documents/Projects/Claude Projects/TPC Houses/house-viewer/.venv/lib/python3.11/site-packages/pymupdf/layout/onnx/common_util.pyÚmake_sessionr   
   s2   € õ 
Ô	Ñ	Ô	€BØ#€BÔÝÔ 
¸ÀyÐQÑQÔQÐQó    )N)Ú__doc__Úonnxruntimer   r   © r   r   ú<module>r      sA   ððð ð Ð Ð Ð ðRð Rð Rð Rð Rð Rr   