Erlang(以及 Elixir 的扩展)是否提供了移除原子的方法?
Does Erlang (and Elixir by extension) provide a way to remove atoms?
能否从 运行宁 Erlang/Elixir 系统中移除原子?
具体来说,我感兴趣的是如何创建一个应用程序服务器,在该服务器上可以加载代表应用程序的模块,运行 按需然后删除。
我想这比仅仅删除代表相关模块的原子更复杂,因为它可能定义了更多难以或不可能跟踪的原子。
或者,我想知道是否可以将模块 运行 隔离,以便在不再需要时可以从 运行ning 系统中有效地删除它产生的所有引用。
编辑:澄清一下,因为 SO 认为这个问题在其他地方得到了回答,所以这个问题与原子的垃圾收集无关,而是与手动管理有关。为了进一步澄清,以下是我对亚历克斯回答的评论:
I have also thought about spinning up separate instances (nodes?) but
that would be very expensive for on-demand, per-user applications.
What I am trying to do is imitate how an SAP ABAP system works. One
option may be to pre-emptively have a certain number of instances
running, then restart them each time a request is complete. (Again,
pretty expensive though). Another may be to monitor the atom table of
an instance and restart that instance when it is close to the limit.
我看到 运行 多个 nodes/instances 的缺点(尽管这是 ABAP 系统所具有的;几个 OS 处理用户请求的进程)是你失去了在这些实例之间共享缓存字节码的能力。在 ABAP 系统中,不同进程可以访问字节码缓存(他们称之为 "load"),因此当程序启动时,它会先检查缓存,然后再从存储中获取它。
不幸的是,在 VM 关闭之前,原子根本不会在 VM 内被破坏。 Atom 限制也跨进程共享,这意味着生成一个新进程来处理 atom allocation/deallocation 在您的情况下不起作用。
您可能会运气好,通过 运行 一个单独的 Erlang 应用程序生成一个完全独立的 VM 实例并通过套接字与其通信,尽管我不确定这会有多有效。
能否从 运行宁 Erlang/Elixir 系统中移除原子?
具体来说,我感兴趣的是如何创建一个应用程序服务器,在该服务器上可以加载代表应用程序的模块,运行 按需然后删除。
我想这比仅仅删除代表相关模块的原子更复杂,因为它可能定义了更多难以或不可能跟踪的原子。
或者,我想知道是否可以将模块 运行 隔离,以便在不再需要时可以从 运行ning 系统中有效地删除它产生的所有引用。
编辑:澄清一下,因为 SO 认为这个问题在其他地方得到了回答,所以这个问题与原子的垃圾收集无关,而是与手动管理有关。为了进一步澄清,以下是我对亚历克斯回答的评论:
I have also thought about spinning up separate instances (nodes?) but that would be very expensive for on-demand, per-user applications. What I am trying to do is imitate how an SAP ABAP system works. One option may be to pre-emptively have a certain number of instances running, then restart them each time a request is complete. (Again, pretty expensive though). Another may be to monitor the atom table of an instance and restart that instance when it is close to the limit.
我看到 运行 多个 nodes/instances 的缺点(尽管这是 ABAP 系统所具有的;几个 OS 处理用户请求的进程)是你失去了在这些实例之间共享缓存字节码的能力。在 ABAP 系统中,不同进程可以访问字节码缓存(他们称之为 "load"),因此当程序启动时,它会先检查缓存,然后再从存储中获取它。
不幸的是,在 VM 关闭之前,原子根本不会在 VM 内被破坏。 Atom 限制也跨进程共享,这意味着生成一个新进程来处理 atom allocation/deallocation 在您的情况下不起作用。
您可能会运气好,通过 运行 一个单独的 Erlang 应用程序生成一个完全独立的 VM 实例并通过套接字与其通信,尽管我不确定这会有多有效。