Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUDA-VMAF Memory Leak(preallocation method) in libvmaf #1300

Open
Yangel1993 opened this issue Jan 4, 2024 · 3 comments
Open

CUDA-VMAF Memory Leak(preallocation method) in libvmaf #1300

Yangel1993 opened this issue Jan 4, 2024 · 3 comments
Labels

Comments

@Yangel1993
Copy link

I am calculating VMAF scores every 30 frames, using the CUDA-accelerated version of VMAF. Currently, the computed VMAF values are accurate each time; however, there is a significant and rapid increase in GPU memory usage. I'm wondering if there might be an issue with proper resource deallocation.

My code is based on the example found in libvmaf/test directory, specifically the test_cuda_picture_preallocation_method_device test case, where I ensure that I initialize (init) and close (close) the VMAF context appropriately for every 30 frames. Despite this, the GPU memory keeps rising steadily.

Could there be a problem with how resources are being released, or are there any suggestions to address this potential memory leak issue?

@nilfm99 nilfm99 added the cuda label Jan 9, 2024
@kylophone
Copy link
Collaborator

The VmafPictures are reference-counted and should be automatically freed when the ref count drops to zero. The framework should take care of when using the preallocation method. Curious if you were able to solve this issue or are still dealing with it?

@Yangel1993
Copy link
Author

The VmafPictures are reference-counted and should be automatically freed when the ref count drops to zero. The framework should take care of when using the preallocation method. Curious if you were able to solve this issue or are still dealing with it?

The issue has not been resolved; I encountered this problem with other methods involving preallocation as well. Ultimately, I switched to a non-preallocating approach using vmaf_picture_alloc, and the functionality without preallocation works as expected.

@gedoensmax
Copy link
Contributor

Allocating on demand is not ideal as an allocation will force a sync on the CUDA device. @MorkTheOrk you are currently working with VMAF could you see if memory is leaked when using FFmpeg ? https://github.com/FFmpeg/FFmpeg/blob/e05d3c1a16c96fee59bf00e23f9d67a79b47220f/libavfilter/vf_libvmaf.c#L149-L166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants