fix: SG-43388: RV leaks memory because of opened decoders - #1316
fix: SG-43388: RV leaks memory because of opened decoders#1316deltag0 wants to merge 20 commits into
Conversation
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <ioan.1931@gmail.com>
686e739 to
b92c079
Compare
Signed-off-by: deltag0 <victor.terme@autodesk.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
I took a look at the code again to refresh myself, and I found that the |
…penRV into RV-loading-source-leak
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
This reverts commit d3ab2c6515f53412c9d5fb3d24d0d0da0b8b2fdd. Passing the track to ContextPool::Reservation at construction removed the implicit liveness check that trackFromStreamIndex provided. When openAVCodec fails, the track is deleted while the Reservation is still in scope, so ~Reservation read a dangling VideoTrack/AudioTrack, and the Context left in m_contextMap kept the stale pointer for later eviction to write through. Also includes the clang-format brace fix the pre-commit hook applies to the restored J2K branch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Fixed & double checked the use of the addition :D |
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Addressed 1,2,3,4 I think 5 is ok |
|
There's a comment saying something "should never happen" should we try to make sure it never happens, or leave it as is? |
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
| IPGraph::WorkItemID IPGraph::addWorkItem(const VoidFunction& function, const char* tag) | ||
| { | ||
| auto jobDispatcher = reinterpret_cast<JobDispatcher*>(m_jobDispatcher); | ||
| if (tag) |
There was a problem hiding this comment.
The tag is optional so we should not check its value here.
It is the m_jobDispatcher that we should check here to be safe.
| { | ||
| auto jobDispatcher = reinterpret_cast<JobDispatcher*>(m_jobDispatcher); | ||
| jobDispatcher->removeJob(id); | ||
| if (id) |
There was a problem hiding this comment.
It is the m_jobDispatcher that we should check here to be extra safe, not the id
| { | ||
| auto jobDispatcher = reinterpret_cast<JobDispatcher*>(m_jobDispatcher); | ||
| jobDispatcher->waitJob(id); | ||
| if (id) |
There was a problem hiding this comment.
It is the m_jobDispatcher that we should check here to be extra safe, not the id
| poolSize = atoi(c); | ||
| } | ||
| if (poolSize > 0) | ||
| globalContextPool = std::make_unique<ContextPool>(poolSize); |
There was a problem hiding this comment.
This should not compile anymore due to your recent change.
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
fix: RV leaks memory because of opened decoders
Summarize your change.
Describe the reason for the change.
Describe what you have tested and on which operating system.
Tested on CY 2025 on Rocky Linux 9.8 and Mac
Opened over 1000 clips with 1GB of caching, peaking at 9GB, but staying bounded.
RAM no longer increases when loading clips without playback being on.
Add a list of changes, and note any that might need special attention during the review.
avcodec_free_context, nullify the tracked pointer to not point to freed memoryNo regressions by adding the context map
If possible, provide screenshots.