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

Memory Leak in VideoFileInput.countFrames() #463

Open
cbrautigam2 opened this issue Oct 28, 2024 · 0 comments
Open

Memory Leak in VideoFileInput.countFrames() #463

cbrautigam2 opened this issue Oct 28, 2024 · 0 comments

Comments

@cbrautigam2
Copy link

Describe the bug
The countFrames() method of VideoFileInput is create a packet and never deleting the packet as part of acquiring the frames. Calling this method multiple times leaks memory and eventually you will get an OOM error similar to this:
java.lang.OutOfMemoryError: Physical memory usage is too high: physicalBytes (17801M) > maxPhysicalBytes (16384M)
at org.bytedeco.javacpp.Pointer.deallocator(Pointer.java:695)
at org.bytedeco.javacpp.Pointer.init(Pointer.java:127)
at org.bytedeco.ffmpeg.avcodec.AVPacket.allocate(Native Method)
at org.bytedeco.ffmpeg.avcodec.AVPacket.(AVPacket.java:50)
at org.jmisb.api.video.VideoFileInput.countFrames(VideoFileInput.java:124)
at org.jmisb.api.video.VideoFileInput.open(VideoFileInput.java:108)

To Reproduce
Steps to reproduce the behavior:
Call VideoFileInput.countFrames() in a loop to parse a file with many klv misb records in it. Watch memory consumption increase.

Expected behavior
I should be able to call this method as much as I want without it leaking memory.

Screenshots
N/A

Configuration (please complete the following information):

  • OS: RHEL 9
  • JDK [openjdk version "21.0.3" 2024-04-16 LTS ]
  • jMISB version or commit [1.12.0]

Additional context
To workaround this for our needs since we don't need the frame count we were able to create a copy of VideoFileInput bypassing countFrames() altogether in the open() method. We no longer run out of memory and crash our application.

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

No branches or pull requests

1 participant