Because that is not possible (or at least very hard) to do in the current design. Atoms are important part of:
modules, as module names are atoms
function names, which also are atoms
distributed Erlang also extensively use atoms
Especially last point makes it hard. Imagine for second that we would have a GC for atoms. What would happen if there would be a GC cleanup in between the distributed call where we send some atoms over the wire? All of that makes atoms quite essential to how VM works and making them GCed would not only make implementation of VM much more complex, it would also make code much slower as atoms do not need to be copied between processes and as these aren't GCed, these can be completely omitted in GC mark step.
1条答案
按热度按时间rks48beu1#
Because that is not possible (or at least very hard) to do in the current design. Atoms are important part of:
Especially last point makes it hard. Imagine for second that we would have a GC for atoms. What would happen if there would be a GC cleanup in between the distributed call where we send some atoms over the wire? All of that makes atoms quite essential to how VM works and making them GCed would not only make implementation of VM much more complex, it would also make code much slower as atoms do not need to be copied between processes and as these aren't GCed, these can be completely omitted in GC mark step.