Project Highlight: Spasm
Sebastiaan Koppe
mail at skoppe.eu
Thu Feb 28 20:36:57 UTC 2019
On Thursday, 28 February 2019 at 12:47:32 UTC, Radu wrote:
> Re. the memory management section, I wonder if reference
> counting using dip1000 would work for memory management.
At least partly. One memory issue spasm has is to release JS
objects once D code is done with them. The approach I am likely
to take is to simply disallow more than 1 reference to a JS
object, and then when that reference is destroyed, to also
destroy the JS object. Basically a non-copyable struct with a
destructor.
Over time this can be expanded with dip1000 to allow having more
references to the same JS object as long as the compiler can
prove it doesn't escape and has shorter lifetime.
I don't see how dip1000 can help free memory though.
> You could also use the type system information for a D malloc
> implementation that uses free lists for known sizes. Something
> in line with https://github.com/JinShil/memcpyD
I saw memcpyD before. In fact I used part of the implementation
in a (uncompleted) wasm port of druntime.
But again, I don't see how it would help with freeing unused
objects.
> It is quite interesting to see that WebAssembly lines up pretty
> close to bare metal programming, maybe there are some synergies
> here that can be exploited and create the minimum runtimes for
> both.
Definitely.
More information about the Digitalmars-d-announce
mailing list