I will try, but it is a little bit hard because the C func is called
from a C++ method deeply inside a complex inheritance tree.
Things that I can verify now are:
(a) The C func is called with no problem 8000 times.
(b) The C func is called for 3000+ and segfaults if I put a
simple rb_warn() inside. Ruby 1.8.0
(c) The C func is called for 6000+ and segfaults if I put a
simple rb_warn() inside. Ruby 1.8.1 preview 3.
Regards,
···
On Sat, Dec 13, 2003 at 10:11:12PM +0900, Yukihiro Matsumoto wrote:
Hi,
In message “strange rb_gc_mark error” > on 03/12/13, Elias Athanasopoulos elathan@phys.uoa.gr writes:
I have a pure C function, which may be called arbitrary
sequential times. If I call any rb_* function inside, including
the simple rb_warn(), I get:
BUG] rb_gc_mark(): unknown data type 0x28(0x89965b0) non object
ruby 1.8.0 (2003-08-04) [i586-linux]
The error occures after a lot of calls; it reminds me the
behaviour of a stack overflow, or something.
Show us whole program, if possible, to reproduce your error.
–
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky
The error ruby reports is on an address of a Foo created pointer.
If I remove the rb_iv_set() call, ruby executes correctly. But, I
have to keep the pointer somewhere in order to execute methods of
the specific class.
Any ideas?
Regards,
···
On Sun, Dec 14, 2003 at 12:02:27AM +0900, Elias Athanasopoulos wrote:
On Sat, Dec 13, 2003 at 10:11:12PM +0900, Yukihiro Matsumoto wrote:
Hi,
In message “strange rb_gc_mark error” > > on 03/12/13, Elias Athanasopoulos elathan@phys.uoa.gr writes:
I have a pure C function, which may be called arbitrary
sequential times. If I call any rb_* function inside, including
the simple rb_warn(), I get:
BUG] rb_gc_mark(): unknown data type 0x28(0x89965b0) non object
ruby 1.8.0 (2003-08-04) [i586-linux]
The error occures after a lot of calls; it reminds me the
behaviour of a stack overflow, or something.
Show us whole program, if possible, to reproduce your error.
I will try, but it is a little bit hard because the C func is called
from a C++ method deeply inside a complex inheritance tree.
Things that I can verify now are:
(a) The C func is called with no problem 8000 times.
(b) The C func is called for 3000+ and segfaults if I put a
simple rb_warn() inside. Ruby 1.8.0
(c) The C func is called for 6000+ and segfaults if I put a
simple rb_warn() inside. Ruby 1.8.1 preview 3.
–
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky
Also, a quick question. Am I creating objects that won’t be GC’d by using
INT2FIX like that?
···
On Sun, 14 Dec 2003, Elias Athanasopoulos wrote:
On Sun, Dec 14, 2003 at 12:02:27AM +0900, Elias Athanasopoulos wrote:
On Sat, Dec 13, 2003 at 10:11:12PM +0900, Yukihiro Matsumoto wrote:
Hi,
In message “strange rb_gc_mark error” > > > on 03/12/13, Elias Athanasopoulos elathan@phys.uoa.gr writes:
I have a pure C function, which may be called arbitrary
sequential times. If I call any rb_* function inside, including
the simple rb_warn(), I get:
BUG] rb_gc_mark(): unknown data type 0x28(0x89965b0) non object
ruby 1.8.0 (2003-08-04) [i586-linux]
The error occures after a lot of calls; it reminds me the
behaviour of a stack overflow, or something.
Show us whole program, if possible, to reproduce your error.
I will try, but it is a little bit hard because the C func is called
from a C++ method deeply inside a complex inheritance tree.
Things that I can verify now are:
(a) The C func is called with no problem 8000 times.
(b) The C func is called for 3000+ and segfaults if I put a
simple rb_warn() inside. Ruby 1.8.0
(c) The C func is called for 6000+ and segfaults if I put a
simple rb_warn() inside. Ruby 1.8.1 preview 3.
Okay, it is my fault.
While writting a C++ extension for Ruby, I do (almost everywhere):
static VALUE foo_init (…)
{
Foo *f = new Foo();
rb_iv_set (self, “ptr”, (VALUE) f);
return self;
}
The error ruby reports is on an address of a Foo created pointer.
If I remove the rb_iv_set() call, ruby executes correctly. But, I
have to keep the pointer somewhere in order to execute methods of
the specific class.
Any ideas?
Regards,
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky
“If you’ve got a 5000-line JSP page that has “all in one” support
for three input forms and four follow-up screens, all controlled
by “if” statements in scriptlets, well … please don’t show it
to me :-). Its almost dinner time, and I don’t want to lose my
appetite :-).”
- Craig R. McClanahan
i don’t know if you can wrap c++ class directly since Data_Make_Struct uses
ALLOC internally…
-a
···
On Sun, 14 Dec 2003, Elias Athanasopoulos wrote:
Date: Sun, 14 Dec 2003 02:33:04 +0900
From: Elias Athanasopoulos elathan@phys.uoa.gr
Newsgroups: comp.lang.ruby
Subject: Re: strange rb_gc_mark error
On Sun, Dec 14, 2003 at 12:02:27AM +0900, Elias Athanasopoulos wrote:
On Sat, Dec 13, 2003 at 10:11:12PM +0900, Yukihiro Matsumoto wrote:
Hi,
In message “strange rb_gc_mark error” > > > on 03/12/13, Elias Athanasopoulos elathan@phys.uoa.gr writes:
I have a pure C function, which may be called arbitrary
sequential times. If I call any rb_* function inside, including
the simple rb_warn(), I get:
BUG] rb_gc_mark(): unknown data type 0x28(0x89965b0) non object
ruby 1.8.0 (2003-08-04) [i586-linux]
The error occures after a lot of calls; it reminds me the
behaviour of a stack overflow, or something.
Show us whole program, if possible, to reproduce your error.
I will try, but it is a little bit hard because the C func is called
from a C++ method deeply inside a complex inheritance tree.
Things that I can verify now are:
(a) The C func is called with no problem 8000 times.
(b) The C func is called for 3000+ and segfaults if I put a
simple rb_warn() inside. Ruby 1.8.0
(c) The C func is called for 6000+ and segfaults if I put a
simple rb_warn() inside. Ruby 1.8.1 preview 3.
Okay, it is my fault.
While writting a C++ extension for Ruby, I do (almost everywhere):
static VALUE foo_init (…)
{
Foo *f = new Foo();
rb_iv_set (self, “ptr”, (VALUE) f);
return self;
}
The error ruby reports is on an address of a Foo created pointer.
If I remove the rb_iv_set() call, ruby executes correctly. But, I
have to keep the pointer somewhere in order to execute methods of
the specific class.
Any ideas?
–
ATTN: please update your address books with address below!
The difference between art and science is that science is what we
understand well enough to explain to a computer.
Art is everything else.
– Donald Knuth, “Discover”
/bin/sh -c ‘for l in ruby perl;do $l -e “print "\x3a\x2d\x29\x0a"”;done’
===============================================================================
which I call from the finalizer of my ruby object.
If you mean the r_osd object, the FixNum, well, I don’t free it…
this is my first extension, and I haven’t been able to find any
documentation on writing ruby extensions outside of pickaxe.
“If you’ve got a 5000-line JSP page that has “all in one” support
for three input forms and four follow-up screens, all controlled
by “if” statements in scriptlets, well … please don’t show it
to me :-). Its almost dinner time, and I don’t want to lose my
appetite :-).”
- Craig R. McClanahan