Skip to content

Commit 9533d30

Browse files
mthrokfacebook-github-bot
authored andcommitted
Fix GPU memory leak on StreamReader (#3186)
Summary: Pull Request resolved: #3186 Fix the GPU memory leak introduced in #3183 The HW frames context is owned by AVCodecContext. The removed `av_buffer_ref` call increased the ferenrence counting unnecessarily, and prevented AVCodecContext from feeing the resource. (Note: this ignores all push blocking failures!) Reviewed By: nateanl Differential Revision: D44231876 fbshipit-source-id: 9be2c33049dd02a3fa82a85271de7fb62e5b09ea
1 parent c5b9655 commit 9533d30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchaudio/csrc/ffmpeg/stream_reader/stream_processor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ AVCodecContextPtr get_codec_ctx(
157157
configure_codec_context(codec_ctx, params, device);
158158
open_codec(codec_ctx, decoder_option);
159159
if (codec_ctx->hw_device_ctx) {
160-
codec_ctx->hw_frames_ctx = av_buffer_ref(get_hw_frames_ctx(codec_ctx));
160+
codec_ctx->hw_frames_ctx = get_hw_frames_ctx(codec_ctx);
161161
}
162162
return codec_ctx;
163163
}

0 commit comments

Comments
 (0)