On 28.03.2007 23:41, Pratik wrote:
> I've already called GC.start and yet some objects are not being freed.
> However, I'm still uncertain about memory leaks in ruby code and
> looking for an example of any such case.

A memory leak comes into existence when some piece of code holds longer 
onto an instance than necessary / intended.  Look at this:

class Foo
   @instances = []

   def self.register(obj)
     @instances << obj
   end

   def initialize
     Foo.register(self)
   end
end

Instances register with their class but never deregister - so they can 
never be collected and use up memory.  My guess would be that you'll 
have a hard time writing a program that is able to track these without 
actually running the code.

Kind regards

	robert