Garbage collector in Ruby on Rails?

丶灬走出姿态 提交于 2021-02-07 07:07:02

问题


I have tried to Google a lot about Rails Garbage collector, but I didn't get a reliable answer. Has anyone got a source to show how garbage collection is implemented in Rails? How can we control it?


回答1:


Rails is a framework, not a language. The language behind Rails is called Ruby.

This means there is no notion of Garbage Collector in Rails. You should search for documentation about the Ruby Garbage Collector.

You can start from the Ruby GC module. The GC module provides an interface to Ruby’s mark and sweep garbage collection mechanism.

Depending on the Ruby language version, the Garbage Collector may have a different behavior. The article How Ruby Manages Memory and Garbage Collection describes the Ruby 1.9 Garbage Collector. In Ruby 2.0 the GC has been improved and the implementation changed a bit.



来源:https://stackoverflow.com/questions/16337185/garbage-collector-in-ruby-on-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!