Any GC.disable performance flaws?

Are there any circumstances in which GC.disable can degrade performance? Is it ok to do this if I use real RAM and not swap memory?

I am using MRI Ruby 2.0, and as far as I can tell, it is 64-bit and uses 64-bit Ubuntu:

 ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux] Linux [redacted] 3.2.0-43-generic #68-Ubuntu SMP Wed May 15 03:33:33 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux 
+6
source share
1 answer

GC.disable will disable garbage collection. Languages ​​like ruby ​​do not have the ability to free memory without garbage collection, because unlike C, you do not manually call up memory in memory.

So yes, there will be a performance hit. In the end, you will run out of memory, because objects such as strings will be constantly created and never cleared. You cannot even be held responsible for the fact that the internal mechanics of the API you are using can generate objects.

Without a better understanding of the problem, this is, unfortunately, the best I can offer.

+1
source

Source: https://habr.com/ru/post/947609/


All Articles