For example, we have class implementation:
class Memory
def call
2 * 2
end
end
we can get report by memory_profiler usage:
require 'memory_profiler'
MemoryProfiler.report{ Memory.new.call }.pretty_print
How to implement the unit test for this which became failed when we have an increase of memory or memory leak in addition changes into Memory#call?
For example, if we going to change Memory#call in this way:
- 2 * 2
+ loop { 2 * 2 }