Skip to content

windows: Fix GC#5745

Merged
algorandskiy merged 3 commits intoalgorand:masterfrom
dragmz:wingcfix
Sep 21, 2023
Merged

windows: Fix GC#5745
algorandskiy merged 3 commits intoalgorand:masterfrom
dragmz:wingcfix

Conversation

@dragmz
Copy link
Copy Markdown
Contributor

@dragmz dragmz commented Sep 18, 2023

Fixes garbage collection on Windows by removing calls to SetGCPercent and replacing the GC stop with a native buffer allocation (LocalAlloc / LocalFree) for fixedInfoWithOverlay.

The previously used code didn't work well on Windows, causing the GC to stop from collecting. The SetGCPercent(pct) didn't restore the GC.

A minimal program that can be used to reproduce the issue with SetGCPercent on Windows:

package main

import "runtime/debug"

func test() {
	pct := debug.SetGCPercent(-1)
	defer debug.SetGCPercent(pct)

	var r [][]byte
	for i := 0; i < 10; i++ {
		r = append(r, make([]byte, 1024))
	}
}

func main() {
	for {
		test()
	}
}

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Sep 18, 2023

CLA assistant check
All committers have signed the CLA.

Comment thread tools/network/dnssec/config_windows.go Outdated
@algorandskiy algorandskiy changed the title windows gc fix windows: Fix GC Sep 18, 2023
Co-authored-by: Pavel Zbitskiy <65323360+algorandskiy@users.noreply.github.com>
Comment thread tools/network/dnssec/config_windows.go
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 18, 2023

Codecov Report

Merging #5745 (8a1eae1) into master (ea20873) will increase coverage by 0.00%.
Report is 1 commits behind head on master.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #5745   +/-   ##
=======================================
  Coverage   55.57%   55.57%           
=======================================
  Files         476      476           
  Lines       66857    66857           
=======================================
+ Hits        37156    37157    +1     
+ Misses      27177    27175    -2     
- Partials     2524     2525    +1     

see 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@algorandskiy algorandskiy requested a review from cce September 19, 2023 18:10
@algorandskiy algorandskiy merged commit 5570e88 into algorand:master Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants