[#1207] warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...>

This message was posted to ruby-talk, but I didn't get responce from

22 messages 2003/07/01
[#1208] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/01

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1209] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/02

ts wrote:

[#1210] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/02

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1211] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1212] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/04

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1213] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1214] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/04

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1215] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1237] FTP.new with block — Gavin Sinclair <gsinclair@...>

Hi,

22 messages 2003/07/19
[#1238] Re: [Patch] FTP.new with block — ts <decoux@...> 2003/07/19

>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:

[#1240] Re: [Patch] FTP.new with block — Mathieu Bouchard <matju@...> 2003/07/19

[#1297] Fix for Bug 1058 — Markus Walser <walser@...>

Hi,

16 messages 2003/07/25

Re: warning in ruby extension eats memory

From: nobu.nokada@...
Date: 2003-07-04 15:05:21 UTC
List: ruby-core #1224
Hi,

At Fri, 4 Jul 2003 22:40:35 +0900,
ts wrote:
> n> rb_call() checks only receiver's class, but nothing for flags.
> 
>  Yes, but what I don't understand is how ruby can have all these calls
> 
> #108450 0x2808af03 in ruby_finalize () from /usr/local/lib/libruby.so.18
> #108451 0x2808b010 in ruby_cleanup () from /usr/local/lib/libruby.so.18
> #108452 0x2808b11f in ruby_stop () from /usr/local/lib/libruby.so.18
> #108453 0x2808b176 in ruby_run () from /usr/local/lib/libruby.so.18
> #108454 0x080485f6 in main ()
> #108455 0x08048515 in _start ()

I can't get what you mean, these seem to be called normally.

>  bad value from getrlimit() ????

On my machine, it was stopped by stack_check() in rb_call0().


Ad-hockery solution.


Index: io.c
===================================================================
RCS file: //sharui/cvs/ruby/src/ruby/io.c,v
retrieving revision 1.218
diff -u -2 -p -r1.218 io.c
--- io.c	26 Jun 2003 18:24:58 -0000	1.218
+++ io.c	4 Jul 2003 14:22:30 -0000
@@ -415,8 +415,6 @@ io_write(io, str)
 	str = rb_obj_as_string(str);
 
-    if (TYPE(io) != T_FILE) {
-	/* port is not IO, call write method for it. */
-	return rb_funcall(io, id_write, 1, str);
-    }
+    Check_Type(io, T_FILE);
+
     if (RSTRING(str)->len == 0) return INT2FIX(0);
 
@@ -2749,4 +2747,8 @@ rb_write_deferr2(mesg, len)
     long len;
 {
+    if (SPECIAL_CONST_P(rb_deferr) || !BUILTIN_TYPE(rb_deferr)) {
+	fwrite(mesg, 1, len, stderr);
+	return;
+    }
     rb_io_write(rb_deferr, rb_str_new(mesg, len));
 }


-- 
Nobu Nakada

In This Thread