Since http is stateless, every request to an app creates a new object. How does Rails clean up the unused objects / how frequently?
Simple answer: the Ruby runtime has a garbage collector. Depending on the runtime (JRuby/JVM generational GC, IronRuby/CLR generational GC, classic Ruby/mark-sweep GC) different algorithms are used. But the basics are pretty simple:
The frequency of collections depends on the tuning of the GC, which may be affected by the operating system, the amount of physical memory, operating system memory pressure, user-controlled tweaks, underlying platform version revisions, dynamically optimized parameters, etc. Much of it comes down to deciding where the bar lies in that "insufficient free memory" test, though things get more complicated with generational collectors.
If you are interested in this you should check out the blog series about copy-on-write garbage collection by the Phusion team and their efforts to improve on the default ruby gc scheme in Ruby Enterprise Edition.
http://izumi.plan99.net/blog/index.php/2007/04/05/saving-memory-in-ruby-on-rails/
Other links in the series here:
http://www.rubyenterpriseedition.com/faq.html