-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mod/modfile: do not reuse a global cue.Context in Parse and ParseLegacy
It seems like a good idea to avoid needing to create new contexts, and particularly since the cue package API documents that: Only values created from the same Context can be involved in the same operation. However, using a global context that is alive forever leaks memory. Whenever a cue.Value is built with a cue.Context, memory is held in the cue.Context as long as the context is alive, even past the time that the cue.Value is no longer kept alive itself. In https://cuelang.org/issue/2121 we recommend that users do not keep a context alive for a long time to build more and more values, as the context will increase in size over time while it's alive. Yet, mod/modfile did that with its global context and the Parse APIs.. Updates #2121. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Idf9ab2b83d1d0650afd801a238b8cf28daa65a0d Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194421 Reviewed-by: Paul Jolly <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
- Loading branch information
Showing
1 changed file
with
52 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters