Open roelmops opened 1 month ago
0.2.0
When I instantiate the nvImageCodec encoder for a second time in a thread, memory is not released. Which is more than 1 GB.
import os import threading import time import numpy as np import psutil from nvidia import nvimgcodec process = psutil.Process(os.getpid()) image_encoder = nvimgcodec.Encoder() array = (np.random.rand(500, 500, 3) * 255).astype(np.uint8) nvim = nvimgcodec.as_image(array) def encode(): image_encoder = nvimgcodec.Encoder() image_encoder.encode(nvim, "jpeg") print("Process memory:") print(f"Before encode in main thread: {process.memory_info().rss / (1024 * 1024):.2f} MB") encode() print(f"After encode in main thead: {process.memory_info().rss / (1024 * 1024):.2f} MB") thread = threading.Thread(target=encode) thread.start() thread.join() print(f"After encode in sub thread: {process.memory_info().rss / (1024 * 1024):.2f} MB")
No response
Process memory: Before encode in main thread: 46.50 MB After encode in main thead: 150.33 MB After encode in sub thread: 1176.45 MB
This is most likely the same issue as described here: https://github.com/NVIDIA/nvImageCodec/issues/13 It should be fixed on the next release: 0.4.0
Version
0.2.0
Describe the bug.
When I instantiate the nvImageCodec encoder for a second time in a thread, memory is not released. Which is more than 1 GB.
Minimum reproducible example
Environment details
No response
Relevant log output
Process memory: Before encode in main thread: 46.50 MB After encode in main thead: 150.33 MB After encode in sub thread: 1176.45 MB
Other/Misc.
No response
Check for duplicates