]> Cypherpunks repositories - gostls13.git/commit
go/token: add (*FileSet).RemoveFile(*File) method
authorAlan Donovan <adonovan@google.com>
Thu, 2 Jun 2022 13:54:12 +0000 (09:54 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 16 Aug 2022 16:27:35 +0000 (16:27 +0000)
commita45bbeae339cd51b60fc59f13da02111f3fc8851
tree5358957472430059b41276bf9254554f63e1bb1e
parent98f3eb2d3edc00ac3c39f23db157b42d14fe6726
go/token: add (*FileSet).RemoveFile(*File) method

The design of FileSet encourages it to be used as a global variable.
Each call to AddFile consumes about 3KB, that is never returned,
even after an application no longer cares about the File.
This change adds a RemoveFile method that a long-running application
can use to release a File that is no longer needed, saving memory.

Fixes golang/go#53200

Change-Id: Ifd34d650fe0d18b1395f922a4cd02a535afbe560
Reviewed-on: https://go-review.googlesource.com/c/go/+/410114
Auto-Submit: Alan Donovan <adonovan@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
api/next/53200.txt [new file with mode: 0644]
src/go/token/position.go
src/go/token/position_test.go