3 ms·
Can someone explain NewLisp's memory management model to me? The description here: http://www.newlisp.org/MemoryManagement.html http://www.newlisp.org/MemoryMan
by thurn 15y ago
Can someone explain NewLisp's memory management model to me? The description here: http://www.newlisp.org/MemoryManagement.html http://www.newlisp.org/MemoryManagement.html makes it sound like NewLisp essentially uses something like an std::auto_ptr from C++ for all its references, but I'm not sure how its possible to write a Lisp where you only ever have one reference to things.
- SoftwareMaven 15y agoIt looks like everything is passed by value, so instead of passing a reference to that int, string, list, array, etc, you are always passing a copy. Once you hit an evaluation contact above where the copy cane from, it can be deleted. I would imagine for some particular set of data (many large arrays and such) that this could get really slow, but their claim is, at least in the general case, it is faster to copy everything.
- praptak 15y agoThey also provide mechanisms to pass by reference. Default pass-by-copy with specially enabled pass-by-reference is indeed the opposite from most other languages do. I wonder how this interacts with things like memory paging and CPU cache.
- _delirium 15y agoDefault pass-by-copy with specially enabled pass-by-reference isn't that uncommon; it's how C++ works, for example.