Skip to content

Commit 71fcd86

Browse files
committed
Move ObjectTemplate leak test into object_template_test.go
since the ignore leaks conditional build was cargo culted from another test file which isn't relevenat here.
1 parent 102abe5 commit 71fcd86

File tree

2 files changed

+19
-36
lines changed

2 files changed

+19
-36
lines changed

object_template_leak_test.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

object_template_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,22 @@ func TestObjectTemplate_garbageCollection(t *testing.T) {
156156

157157
runtime.GC()
158158
}
159+
160+
func TestObjectTemplate_leakCheck(t *testing.T) {
161+
isolate := v8.NewIsolate()
162+
global := v8.NewObjectTemplate(isolate)
163+
164+
cb := func(info *v8.FunctionCallbackInfo) *v8.Value {
165+
// referencing global seems to be the cause of the leak
166+
_ = global
167+
168+
return v8.Null(isolate)
169+
}
170+
171+
global.Set("fn", v8.NewFunctionTemplate(isolate, cb), v8.ReadOnly)
172+
173+
context := v8.NewContext(isolate, global)
174+
context.Close()
175+
176+
isolate.Dispose()
177+
}

0 commit comments

Comments
 (0)