2 ms·
Yeah, this is what I do for my Go SQLite driver: reserve a large amount of memory through a protected, private, anonymous mapping, then grow it as needed, hopin
by ncruces 2y ago
Yeah, this is what I do for my Go SQLite driver: reserve a large amount of memory through a protected, private, anonymous mapping, then grow it as needed, hoping that's “free”:
https://github.com/ncruces/go-sqlite3/blob/v0.25.0/internal/alloc/alloc_unix.go#L25 https://github.com/ncruces/go-sqlite3/blob/v0.25.0/internal/...
The default was to reserve 4GB per connection, because each Wasm sandbox can allocate at most that, and each connection is its own sandbox.
It works fine, until it doesn't and I get users complaining this messes up almost everything slightly more complicated than Linux on bare metal:
https://news.ycombinator.com/item?id=42057378 https://news.ycombinator.com/item?id=42057378
Now I do mostly the same, but reserve 256MB (or even less) per connection. It works, but it's not free.