samg / diffy

Easy Diffing in Ruby
http://rubygems.org/gems/diffy
MIT License
1.27k stars 104 forks source link

Use posix-spawn instead of forking to reduce memory usage #101

Closed kurttomlinson closed 4 years ago

kurttomlinson commented 5 years ago

Forking creates a new process with the same memory usage as the parent process. Since ruby doesn't give memory back to the operating system, this can cause the calling process to bloat and consume much more memory than is necessary.

By using spawn, the new process consumes far less memory and returns it to the operating system once it has completed. This is very beneficial for long-running processes such as rails app servers.