-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync: do not clear sync.Pools completely every GC
Specifically, we clear only half of the poolLocals. To do this we also have to switch from a global array of Pools to a linked list, so that we can retain Pools in use and drop Pools that are empty without allocating. This means that, for a Pool that suddenly stops being used and gets dropped: - during the first GC: half of the poolLocals are cleared - during the second GC: the second half of the poolLocals are cleared - during the third GC: the Pool itself is dropped from allPools This simplified approach is chosen as this allows to not have to worry about resizing the shared arrays during clearPools and it does not add any synchronization (or atomic operations) during Put/Get. Fixes golang#22950
- Loading branch information
Showing
2 changed files
with
203 additions
and
8 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
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