4 ms·
ErlangVM's GC does exactly this. Memory is scoped in a closure around a process, and any time the process goes down all its memory its thrown away. Also anytim
by true_religion 10y ago
ErlangVM's GC does exactly this. Memory is scoped in a closure around a process, and any time the process goes down all its memory its thrown away.
Also anytime a functions scope terminates, all its memory immediately goes away.
This can be done because its a functional language with immutable data structures.
- dsp1234 10y agoI work in VBScript inside of classic ASP and the statement, "Also anytime a functions scope terminates, all its memory immediately goes away.", is true there. I doubt anyone would suggest that VBScript is a functional language with immutable data structures. Additionally, all memory used by a page is cleaned up when the page is finished processing. This has to do with "Memory is scoped" more than immutable data structures.
- philosopheer 10y agoI think you mean memory usage is lexically scoped because no pointers to blocks are saved or returned? I think, and didn't really want to think harder, just thought in the same sense that functional brings some useful baggage with it, so does lexical scope.
- toast0 10y ago> Also anytime a functions scope terminates, all its memory immediately goes away. I don't think this is accurate; those values remain until GC is triggered for the process or the process terminates.
- PeCaN 10y agoErlang's GC is the perfect example of ‘work smarter, not harder’. It's not a particularly advanced GC, it just does so little work that it's soft-real-time capable. As usual, excellent prog21 article: http://prog21.dadgum.com/16.html http://prog21.dadgum.com/16.html (I miss prog21 already…)