Comments (5)
Hey @matthewmueller, I'm not experiencing any OOM errors.
I'll share if I find something interesting.
Thanks for the quick answer!
from bud.
Hey @Fuerback, thanks for doing this research! I'd say it's still a bit early days for memory optimization in Bud, but I did see rogchap/v8go#367 the other day, which is potentially related.
Are you experiencing out of memory (OOM) errors? It might just build up and then garbage collection triggers after a bit.
If you dig any deeper, please share your findings!
from bud.
V8 isolate is never closed:
Line 17 in bff7b1f
from bud.
Also, if reusing isolates, value should be released after Eval. This could also leak memory. New v8go release has:
defer value.Release()
I've had a similar problem on experiment side project where I tried to write simpler svelte renderer in Go. I wanted to reuse isolates for better performance. But memory usage would just spike up since rendered html would not get cleared from memory.
Now I tried adding value.Release()
and it seems it solved this issue.
from bud.
@dobarx, thanks for your research!
Right now we are re-using the isolates and context for the duration of the running process, but they do get cleaned up on close:
Lines 133 to 138 in bff7b1f
This feels like the right approach so only need to load these svelte templates once, then when rendering HTML, it's just calling those functions over and over again. I haven't had the time to do any more in-depth research on this topic yet.
FWIW, my thinking around keeping context around is that since we're running developer-controlled scripts, we're not concerned about security issues that would otherwise crop up from user-run scripts. It's a bit faster too IIRC.
You are right that we aren't currently releasing the value:
Lines 113 to 131 in bff7b1f
value.Release()
, does seem promising.
from bud.
Related Issues (20)
- generated app directory fails linting with golangci-lint HOT 1
- feature idea: detect git short version hash during build and embed into binary HOT 2
- feature suggestion: `bud run` should launch browser (maybe with a flag to enable?) HOT 1
- Error during cURL Installation (Mac) HOT 5
- How to integrate svelte libraries into bud HOT 1
- Rendering HTML from Svelte SSR HOT 1
- invalid: unknown revision since 0.2.6 HOT 2
- Improve bud create logging HOT 2
- How to change default id:int to name:string in generated url path? HOT 1
- How to cross compile linux app binary in my macos machine? HOT 3
- bud run fails right after adding controller following video HOT 18
- Support for FreeBSD HOT 1
- Ship statically linked binaries? HOT 1
- undefined: sqlite3.Error issue HOT 5
- Middleware support? HOT 1
- Dev server breaks as soon as I generate a new controller HOT 2
- Issue with afs on bud run HOT 1
- Add support for skeleton UI HOT 1
- How to use rearmost part of url as parameter? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bud.