dop251 / goja

ECMAScript/JavaScript engine in pure Go
MIT License
5.43k stars 365 forks source link

Circular References Memory Leak #587

Closed Hyhyx closed 2 months ago

Hyhyx commented 2 months ago

5dbe7c14-f386-498f-9788-92427f6efa46

There are many anonymous functions in my program, and during batch runs, I found that memory keeps growing. Currently, I have found that the functions have circular references. How do I optimize them?

359a6ea8-fe4f-46d5-b23b-b1202e455c63

dop251 commented 2 months ago

Circular references in Go do not cause memory leaks unless you define a finalizer on any if the involved objects (which goja doesn't do).