Closed lrfdehao closed 1 year ago
Can you provide a code example showing the issue?
func a() []struct {
var res []struct
vm := otto.New()
_, err = vm.Run(src) // src: js script , too long
if err != nil {
return nil, err
}
if value, err := vm.Get("prefix"); err == nil {
for _, v := range value.Object().Keys() {
data, _ := data.Export()
if data, ok := data.([]map[string]interface{}); ok {
for _, y := range data {
// res append
// some logic append []struct
}
return &res
}
}
}
}
// src: js script , too long
The problem is likely in here - could you try cutting the javascript down to something minimal to demonstrate the issue? You could even start off with an empty script perhaps, to prove the issue isn't in the rest of the code.
All right, thank you. I'll do a double check here
I wonder why my vm.Run() is causing the program's memory to grow slowly.
can i release the Value{} object memory by myself?