Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions object_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,22 @@ func TestObjectTemplate_garbageCollection(t *testing.T) {

runtime.GC()
}

func TestObjectTemplate_leakCheck(t *testing.T) {
isolate := v8.NewIsolate()
global := v8.NewObjectTemplate(isolate)

cb := func(info *v8.FunctionCallbackInfo) *v8.Value {
// referencing global seems to be the cause of the leak
_ = global

return v8.Null(isolate)
}

global.Set("fn", v8.NewFunctionTemplate(isolate, cb), v8.ReadOnly)

context := v8.NewContext(isolate, global)
context.Close()

isolate.Dispose()
}