Help Needed urgently

I am able to implement manual memory management in Ruby.I can allocate
and deallocate the object by myself but The Garbage collector is not
marking nor allocating the object, but its creating the object. Does it
causing any memory leak?

Regards

Tridib

On Mon, Nov 28, 2011 at 21:08, Tridib B. [email protected]
wrote:

I am able to implement manual memory management in Ruby.I can allocate
and deallocate the object by myself but The Garbage collector is not
marking nor allocating the object, but its creating the object.

I don’t get what you mean.

First off, why would you want to allocate and deallocate memory
manually? This is Ruby, not C, you don’t have to do that. Having to
keep track of stuff like that manually, is why I was so happy to leave
C behind!

Second, what do you mean by “creating the object” if it’s not
“allocating the object”? Maybe you mean setting the fields, but since
memory hasn’t been allocated it’s trying to do it at address zero, or
some address that’s whatever random garbage happened to be in the
pointer?

Third, what is “it”, that’s creating the object? The GC certainly
shouldn’t be doing that.

Does it causing any memory leak?

Can’t tell yet until I have a clearer picture of what it’s doing. But
since the probability is so high, see Question One.

-Dave

Dave A. wrote in post #1034307:

On Mon, Nov 28, 2011 at 21:08, Tridib B. [email protected]
wrote:

I am able to implement manual memory management in Ruby.I can allocate
and deallocate the object by myself but The Garbage collector is not
marking nor allocating the object, but its creating the object.

I don’t get what you mean.

I am trying to allow the user to manually allocate and free memory
whenever they want to.

First off, why would you want to allocate and deallocate memory
manually? This is Ruby, not C, you don’t have to do that. Having to
keep track of stuff like that manually, is why I was so happy to leave
C behind!

I learned from a paper based on Java that if we implement manual
deallocation of objects along with Garbage Collection then it can
improve the performance by 30%. So i am trying to implement the same
scenario in Ruby.

Second, what do you mean by “creating the object” if it’s not
“allocating the object”? Maybe you mean setting the fields, but since
memory hasn’t been allocated it’s trying to do it at address zero, or
some address that’s whatever random garbage happened to be in the
pointer?

Creating the Object means-- I debugged some print statement inside
rb_newobj() method in gc.c file to check when the new object is defined.
So I can see that statement of mine.

Tridib B.

Tridib B. wrote in post #1035615:

I debugged some print statement inside rb_newobj() method in gc.c
file to check when the new object is defined. So I can see that
statement of mine.

Set a breakpoint on that function in GDB instead of printing things.
It will save you time and help you explore and learn the code faster.

http://heather.cs.ucdavis.edu/~matloff/UnixAndC/CLanguage/Debug.html