Ruby garbage collect

后端 未结 6 503
死守一世寂寞
死守一世寂寞 2020-12-29 03:34

When would you use this garbage collection method in your Ruby program(s)?

GC.start
6条回答
  •  自闭症患者
    2020-12-29 04:03

    There are occasions when it's necessary to kick it off, but usually it works fine by itself. I've had situations where an app will chew through 1GB of memory if left unchecked, pushing deep into swap, where triggering GC.start intermittently will cut that to 100MB.

    The trouble is that calling this method is very expensive and can slow down your application considerably if used aggressively.

提交回复
热议问题