Closed philipp-schmidt closed 3 years ago
Perfect, thanks! In which pypi package version will this fix be included? 2.4.0 won't be changed right? 2.5.0? Asking because I could use this fix in production atm.
It will make it to 2.6.0 (20.12 release) We code froze for 20.11 a while ago. You can use the patch I shared to build a fixed version of the python library. In my understanding it should be backward compatible.
Alright, will do. Thanks again for the fast fix as always.
Description The python client SDK currently leaks memory when registering and unregistering shared memory (very often) in a single process. This is because the current implementation does not unmap the shared memory on destroy.
Triton Information version: nvcr.io/nvidia/tritonserver:20.08-py3
Are you using the Triton container or did you build it yourself? NGC
To Reproduce Repeat in a single process: triton_client.register_system_shared_memory() shm.set_shared_memory_region() triton_client.unregister_system_shared_memory() shm.destroy_shared_memory_region()
Expected behavior RAM usage of the process does not constantly increase.
Additional info The current client implementation only does
shm_unlink
: https://github.com/triton-inference-server/server/blob/8ea7cc316d5d5baf4f6367c7be298e93f4e9876f/src/clients/python/library/tritonclient/utils/shared_memory/shared_memory.cc#L130-L140The server on the other hand properly unmaps the memory: https://github.com/triton-inference-server/server/blob/12f29e1d76d4d031b630f36ad0a27429d7f5716e/src/servers/shared_memory_manager.cc#L171-L182
According to this site, memory is only released if unmapped:
Probable quick n dirty fix (untested and coded right here and now):