Skip to content

Commit

Permalink
Move ObjectTemplate leak test into object_template_test.go
Browse files Browse the repository at this point in the history
since the ignore leaks conditional build was cargo culted from another test
file which isn't relevenat here.
  • Loading branch information
dylanahsmith committed Feb 11, 2022
1 parent 102abe5 commit 71fcd86
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 36 deletions.
36 changes: 0 additions & 36 deletions object_template_leak_test.go

This file was deleted.

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()
}

0 comments on commit 71fcd86

Please sign in to comment.