Skip to content

fix(runtime): prevent leaks in two-pass timestamp inference - #3448

Open
wangxiuwen wants to merge 1 commit into
modelscope:mainfrom
wangxiuwen:fix/tpass-buffer-lifetime
Open

fix(runtime): prevent leaks in two-pass timestamp inference#3448
wangxiuwen wants to merge 1 commit into
modelscope:mainfrom
wangxiuwen:fix/tpass-buffer-lifetime

Conversation

@wangxiuwen

Copy link
Copy Markdown

What does this PR do?

Fix two ownership leaks in the timestamp pass of FunTpassInferBuffer:

  • Replace the per-iteration heap allocations for the one-element input pointer and length arrays with stack arrays.
  • Release the fetched AudioFrame before the empty-result early continue.

Why is this needed?

The input arrays were allocated with new[] on every timestamp-pass iteration and were never released. In addition, when SplitStr returned no fields, control skipped the existing frame cleanup at the end of the loop.

Both leaks accumulate while processing two-pass streaming audio. The stack arrays have the same lifetime required by the synchronous Forward call and require no ownership management.

Validation

  • git diff --check
  • Verified both Forward overloads still receive the same one-element pointer and length arrays.
  • Verified every loop exit now releases the fetched frame.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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

Successfully merging this pull request may close these issues.

1 participant