sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.57k stars 268 forks source link

window.DefineFunction causes memory leak #240

Closed UnnoTed closed 4 years ago

UnnoTed commented 4 years ago

In the video below you can see that when a window.DefineFunction is present it leaks memory.

First i test without DefineFunction, then with. https://streamable.com/km49xr

I haven’t tested other Go fucntions.

Code: https://sciter.com/wp-content/uploads/2020/07/leak.zip

pravic commented 4 years ago

I believe, it has something to do with the GC.

Could you test with the following? https://gist.github.com/pravic/e0468624cf79cb0e7d7d27f880d61698/revisions

UnnoTed commented 4 years ago

Running Go's GC between element changes prevents the memory from increasing further than the (#b2)big elements' ram usage, i'll do that in my app, thanks.

pravic commented 4 years ago

I mean, you don't have to run GC manually - eventually the memory will be freed anyway.