-
Notifications
You must be signed in to change notification settings - Fork 409
Closed
Labels
Description
package gojatest
import (
"runtime"
"testing"
"time"
"github.com/dop251/goja"
)
func TestWeakMap(t *testing.T) {
for i := 0; i < 100; i++ {
r := goja.New()
r.RunScript("", "var x = {}; new WeakMap().set(x, {})")
r = nil
}
runtime.GC()
time.Sleep(100 * time.Millisecond)
runtime.GC()
time.Sleep(100 * time.Millisecond)
}
$ go test weakmap_test.go -memprofile=/tmp/heap
There are still tons of inuse_objects:
Still have no idea why (it seems to be related with runtime.SetFinalizer).