On Tue, Mar 11, 2008 at 7:51 AM, Venkat Bagam <bagam_venkat / hotmail.com> wrote:
> Ben Oakes wrote:
>  > Where do you think your memory leak is?  (Also, why don't you think
>  > Ruby's garbage collecting is handling it?  Maybe you have references
>  > to things you're not using anymore?)
>  >
>
>  I have assigned the useless object references to nil. You can observe, I
>  assigned
>
>  page = nil
>  page_links = nil
>  doc = nil
>  file_name = nil at some point of the program, where I no longer needed
>  them. Doesn't assigning a ref to nil, completely free its object memory?
>  Isn't nil an empty object? Does nil also claims memory? I am very sorry
>  if my questions doesn't make any sense !!!
>  --
>
>
> Posted via http://www.ruby-forum.com/.
>
>

I haven't had much time to review the code you've posted, but
regarding your questions here, nil *does* take up memory, however,
there is only *one* instance of nil (or NilClass, rather), if I
remember correctly.  Whenever you use "nil," you are using the
reference to that class.  (That is, every nil points to the same
place.)  If you believe that your objects are still resident after
garbage collecting, there's a chance that you still have references to
them somewhere in memory.  (For example, you may set a variable that
once held an array to nil, but then if that array had references to
other objects, there would still be a reference count above 0, so the
objects would stick around.  I'm not sure if that example would hold
true, but I believe that's what the general idea is.)

I hope this helps,

-- Ben