更新时间:2022-06-12 20:58:30
除了破解底层 C 代码,没有.垃圾收集由运行时管理,因此您不必担心.这是一个不错的参考 关于 Ruby 2.0 中的算法.
Other than hacking the underlying C code, no. Garbage collection is managed by the runtime so you don't have to worry about it. Here is a decent reference on the algorithm in Ruby 2.0.
一旦您不再引用内存中的对象,垃圾收集器就会开始工作.你应该没事.
Once you have no more references to the object in memory, the garbage collector will go to work. You should be fine.