Clear buffers of filtered clips after processing in ClipWriterStage#1876
Clear buffers of filtered clips after processing in ClipWriterStage#1876suiyoubi wants to merge 4 commits into
Conversation
…o prevent memory bloat. Added unit test to verify buffer clearance functionality. Signed-off-by: Ao Tang <aot@nvidia.com>
Greptile SummaryThis PR fixes a memory leak in Confidence Score: 5/5Safe to merge — focused bug fix with targeted tests and no regressions introduced. The change is a minimal, well-scoped fix that closes a real memory leak. The refactoring into No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ClipWriterStage.process] --> B[Write clip embeddings to buffer]
B --> C[Submit clip write tasks]
C --> D[Submit filtered_clip write tasks]
D --> E[Wait for all futures]
E --> F[Write video-level embeddings & metadata]
F --> G[_cleanup_video_data]
G --> H[video.clips: clear buffer, embedding, windows]
G --> I[video.filtered_clips: clear buffer]
H --> J[Task returned]
I --> J
Reviews (3): Last reviewed commit: "Merge branch 'main' into aot/free-buffer" | Re-trigger Greptile |
| for clip in video.filtered_clips: | ||
| clip.buffer = None |
There was a problem hiding this comment.
Consider clearing
cosmos_embed1_embedding on filtered clips
The cleanup block for regular video.clips clears both clip.buffer and clip.cosmos_embed1_embedding. If a filtered clip somehow acquires an embedding (e.g., via a future pipeline change or if the ordering of stages varies), its embedding would not be released here. For symmetry with the existing cleanup pattern and defensive memory management, consider also setting clip.cosmos_embed1_embedding = None.
There was a problem hiding this comment.
@greptile-apps, no need : filtered clips are moved to video.filtered_clips by MotionFilterStage or AestheticFilterStage — both run before the embedding stages.
CosmosEmbed1FrameCreationStage and CosmosEmbed1EmbeddingStage only iterate video.clips, so filtered clips can never have cosmos_embed1_embedding set.
There was a problem hiding this comment.
That makes sense — if the filtering stages always run before the embedding stages and the embedding stages only touch video.clips, there's no path for filtered clips to acquire cosmos_embed1_embedding. The existing cleanup is sufficient.
Tip: You can give me more context with .greptile/rules so I get this right next time.
…ated method. Signed-off-by: Ao Tang <aot@nvidia.com>
|
/ok to test a8b63ef |
Description
Usage
# Add snippet demonstrating usageChecklist