On Mon, Dec 26, 2011 at 9:18 PM, Tridib Bandopadhyay <tridib04 / gmail.com> wrote:
> I have made an extension of my own which will help the user to manually
> allocate and deallocate an object using a ruby program in a stack which
> my extension file is handling, and my extension does work properly.

Apparently not because:

> Now I debugged some code in gc.c file and came to the point that Garbage
> Collector is also marking that same object and hopefully allocating
> also(which I am not sure) as a result there will duplicate objects in
> the memory.To check this I asked for when the garbage collector is
> freeing the memory.Is there any other way I can check if the garbage
> collector is storing the object in the memory or not?

I do not know the code but apparently you have managed to mix up
Ruby's allocation with your own.  It seems you want to build an
optimization by placing some objects on the stack.  However, you need
to be aware that this approach will fail the very moment that you pass
a reference of your stack stored object to another object which
resides on the heap (i.e _not_ on the stack).

> Also, I have some few questions also-
>
> 1. Why some methods/Functions inside some file starts with the name--
>
> rb_alloc()... what does the "rb" in the method name means?

"rb" means "Ruby".  This is the C version of a namespace.

> 2. Is there any way to stop the ruby program in the middle of
> execution?. Like sleep type of function

Sleeping is not exactly stopping.  If you work with a C debugger you
only need to set a breakpoint at the proper location.

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/