Source file
misc/cgo/test/issue21897.go
1
2
3
4
5
6
7
8 package cgotest
9
10
14 import "C"
15 import (
16 "runtime/debug"
17 "testing"
18 "unsafe"
19 )
20
21 func test21897(t *testing.T) {
22
23 defer debug.SetGCPercent(debug.SetGCPercent(1))
24
25 for i := 0; i < 10000; i++ {
26 testCFNumberRef()
27 testCFDateRef()
28 testCFBooleanRef()
29
30
31 byteSliceSink = make([]byte, 1024)
32 }
33 }
34
35 var byteSliceSink []byte
36
37 func testCFNumberRef() {
38 var v int64 = 0
39 xCFNumberRef = C.CFNumberCreate(C.kCFAllocatorSystemDefault, C.kCFNumberSInt64Type, unsafe.Pointer(&v))
40
41 }
42
43 var xCFNumberRef C.CFNumberRef
44
45 func testCFDateRef() {
46 xCFDateRef = C.CFDateCreate(C.kCFAllocatorSystemDefault, 0)
47
48 }
49
50 var xCFDateRef C.CFDateRef
51
52 func testCFBooleanRef() {
53 xCFBooleanRef = C.kCFBooleanFalse
54
55 }
56
57 var xCFBooleanRef C.CFBooleanRef
58
View as plain text