Skip to content

Commit fd2a552

Browse files
committed
run runtime.GC() a few times before checking for leaks
1 parent edc462d commit fd2a552

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

openssl/openssl_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ func TestMain(m *testing.M) {
2424
fmt.Println("OpenSSL version:", openssl.VersionText())
2525
fmt.Println("FIPS enabled:", openssl.FIPS())
2626
status := m.Run()
27-
runtime.GC()
27+
for i := 0; i < 5; i++ {
28+
// Run GC a few times to avoid false positives in leak detection.
29+
runtime.GC()
30+
}
2831
openssl.CheckLeaks()
2932
os.Exit(status)
3033
}

scripts/openssl.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ rm -rf "openssl-$version"
4848
mv "openssl-$tag" "openssl-$version"
4949

5050
cd "openssl-$version"
51-
./config $config
51+
# -d makes a debug build which helps with debugging memory issues and
52+
# other problems. It's not necessary for normal use.
53+
./config -d $config
5254
make -j$(nproc) $make
5355

5456
cp -H ./libcrypto.so "/usr/lib/libcrypto.so.${version}"

0 commit comments

Comments
 (0)