Ask a Question related to Ruby, Design and Development.
-
Eugene Scripnik #1
warning in ruby extension eats memory
I've written extension in C for ruby and created test case for it. When
I've run it ruby eat all memory. I've simplified code as I can and here
is what I get:
#include "ruby.h"> cat test.c
typedef struct test_info {
char *dummy;
} TestInfo;
static VALUE rb_cTest;
static VALUE test_free( TestInfo *info ) {
rb_warn( "this warning makes ruby mad when used with test/unit" );
if ( info ) free( info );
}
static VALUE test_s_allocate( VALUE klass ) {
return Data_Wrap_Struct( klass, 0, test_free, 0 );
}
static VALUE test_initialize( VALUE self ) {
DATA_PTR( self ) = ALLOC( TestInfo );
return self;
}
void Init_mytest() {
rb_cTest = rb_define_class( "MyTest", rb_cObject );
rb_define_alloc_func( rb_cTest, test_s_allocate );
rb_define_method( rb_cTest, "initialize", test_initialize, 0 );
}
require "mkmf"> cat extconf.rb
create_makefile("mytest")
#!/usr/local/bin/ruby -w> cat test.rb
require 'test/unit'
require 'mytest'
t = MyTest.newruby 1.8.0 (2003-06-20) [i386-freebsd5.1]> ruby -v
Note, if I remove "require 'test/unit'" line or rb_warn from extension
everything is ok.
--
Eugene Scripnik
IT Group
Software Architect
Tel./Fax +380 (372) 58-43-10
email: [email]Eugene.Scripnik@itgrp.net[/email]
[url]http://www.itgrp.net/[/url]
Eugene Scripnik Guest
-
#40236 [NEW]: echo ... | php -a function allocation eats memory
From: csaba at alum dot mit dot edu Operating system: Win XP PHP version: 5CVS-2007-01-25 (snap) PHP Bug Type: Scripting... -
Jrun Hangs and Eats Memory
Recently we updated an application and it now sends search results to the session. Ever since we put this live we've expereienced Jrun hangs with... -
Memory consumption of Ruby/mod_ruby combo on Apache [memory leak]
> I don't think so - I think all the modules are loaded when Apache is It didn't have anything to do with IfModules or even Apache. I had a... -
OSX eats unbounded amounts of memory
I'm trying to understand some virtual memory strangeness I'm seeing. After a reboot, I have lots of free memory available (as shown by 'top'). ... -
ASP.NET eats memory too much
200 MB is not that much for an ASP.Net web application, depending upon the amount of traffic it receives. ASP.Net leverages memory very well, but...



Reply With Quote

