From: ts Date: 2001-03-14T19:12:53+09:00 Subject: [ruby-talk:12616] Re: Strange segmentation fault problem with C++ extension [source] LONG >>>>> "P" == Paul C writes: P> # irb --prompt xmp P> require 'Zip' [...] P> ruby 1.6.3 (2001-03-07) [i386-netbsd1.5] P> Abort (core dumped) It was not possible, for me, to reproduce this problem pigeon% irb irb(main):001:0> require 'Zip' true irb(main):002:0> z = Zip::ZipFile.new "test.zip" # irb(main):003:0> z.entries { |e| print e.path, "\n" } extconf.rb Makefile # irb(main):004:0> z.entry "extconf.rb" # irb(main):005:0> z.entry "zzzzzzz" RuntimeError: Entry not found (irb):5:in `entry' (irb):5:in `irb_binding' irb(main):006:0> z.entry "extconf.rb" # irb(main):007:0> pigeon% I've tried with 1.6.2 and 1.7.0 P> if ( (buffer = (char *) calloc(length,sizeof(char))) == NULL ) { P> rb_raise ( rb_eRuntimeError, "could not allocate buffery memory" ) ; P> } Possible memory leak , buffer is never free P> try { is-> read ( buffer,length ) ; P> } P> catch ( exception &excp ) { P> rb_raise ( rb_eRuntimeError, excp.what() ) ; P> } P> data = rb_str_new ( buffer, length ) ; P> DEBUG_METHOD("Got Buffer Length",data,length) ; P> DEBUG_MSG("Leaving Function getDataFromInputStream") ; P> return data ; P> } Guy Decoux