Trouble squashing Ruby bug

I’m writing a c++ Ruby extension that seems to be running into some
kind of a memory issue. I’m getting “HEAP: free heap block modified
after it was freed” when I attempt to either allocate a new
array(rb_ary_new) or push onto a ruby array(rb_ary_push) at a certain
point in my program. I can’t seem to find any buffer overflows - which
I believe is one cause for such an error. So it leads me to believe
that maybe my “marking” functionality may be flawed. But as far as I
can see I’m handling the marking properly - I mark anything that is not
a fixnum( arrays, other classes, etc). Are there any newbie marking
mistakes anyone knows of that could cause an issue like this?

This problem only happens when my extension uses a decent amount of
memory - so I’m not sure if there is some kind of a Ruby heap limit
that I’m going over.

I’m just curious if anyone has encountered a problem similar to this
that they have overcome? Its been almost a week where I have
essentially been at a standstill with development. I’ve even got an
evaluation of Insure++ to help me look for memory issues - all to no
avail.

Thanks, Let me know if there is any additional information I can
provide to clarify any details.

Joe

I’m writing a c++ Ruby extension that seems to be running into some
kind of a memory issue.

Whether you are using SWIG or not, their Ruby memory management
documentation may be helpful. It was for me.

http://www.swig.org/Doc1.3/Ruby.html#Ruby_nn57

Good luck!

rickhg12hs wrote:

I’m writing a c++ Ruby extension that seems to be running into some
kind of a memory issue.

Whether you are using SWIG or not, their Ruby memory management
documentation may be helpful. It was for me.

http://www.swig.org/Doc1.3/Ruby.html#Ruby_nn57

Good luck!

Thanks - I’ll check that out

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs