1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 //void testHandleLeaks();
16 var issue8517counter
int
19 kernel32
= syscall
.MustLoadDLL("kernel32.dll")
20 getProcessHandleCount
= kernel32
.MustFindProc("GetProcessHandleCount")
23 func processHandleCount(t
*testing
.T
) int {
24 const current_process
= ^uintptr(0)
26 r
, _
, err
:= getProcessHandleCount
.Call(current_process
, uintptr(unsafe
.Pointer(&c
)))
33 func test8517(t
*testing
.T
) {
34 c1
:= processHandleCount(t
)
36 c2
:= processHandleCount(t
)
37 if c1
+issue8517counter
<= c2
{
38 t
.Fatalf("too many handles leaked: issue8517counter=%v c1=%v c2=%v", issue8517counter
, c1
, c2
)
42 //export testHandleLeaksCallback
43 func testHandleLeaksCallback() {