From: Hugh Sasse Date: 2007-10-03T22:54:33+09:00 Subject: Re: gc.c -- possible logic error? On Wed, 3 Oct 2007, Hugh Sasse wrote: > On Wed, 3 Oct 2007, Eric Hodel wrote: > > > It is also here: > > > > http://rubyforge.org/frs/download.php/12818/mem_inspect-1.0.0.gem > > > For anyone else about to try this: [...] > All the routes through the ruby_mem_inspect_build script assume cvs. > I've enough information to work around that, I think. OK, I've managed that. The results could do with some interpretation. http://www.eng.cse.dmu.ac.uk/~hgs/ruby/memory_map.18681.1191417911.png that is for: http://www.eng.cse.dmu.ac.uk/~hgs/ruby/hashes_read_yaml.rb leaving it to finish its sleep. My modified ruby_mem_inspect_build is: #!/scratch/hgs/local/bin/ruby -w ##!/usr/local/bin/ruby -w require 'rubygems' require 'rake' # ruby_dir = "mem_inspect_ruby_1_8" ruby_dir = "/scratch/hgs/ruby-1.8.6-p110" old_pwd = Dir.pwd CVS = false SVN = false # PREFIX = "/usr/local" PREFIX = "/scratch/hgs/local" # Sun's patch and make are usually not up to snuff. Set these as # apppropriate. (Ruby could do with something to search ENV['PATH']) MAKE = "gmake" PATCH = "gpatch" if File.exist? ruby_dir then Dir.chdir ruby_dir do "sh cvs up" if CVS end else sh "cvs -z4 -d :pserver:anonymous@cvs.ruby-lang.org:/src co -d #{ruby_dir} -r ruby_1_8 ruby" if CVS end Dir.chdir ruby_dir do if CVS # Why delete and update if we have just got it? sh "rm gc.c" sh "cvs up gc.c" end sh "#{PATCH} < #{File.join old_pwd, "gc.c.patch"}" sh "autoconf" unless File.exist? "configure" sh "./configure --prefix=#{PREFIX} --program-suffix=_mem_inspect" unless File.exist? "Makefile" sh MAKE puts "*" * 80 puts "Ruby has been built in #{ruby_dir}, but not installed" puts puts "If you run:" puts puts "\tcd #{ruby_dir}; sudo #{MAKE} install" puts puts "YOU WILL OVERWRITE YOUR STDLIB" puts puts "Generally, this is harmless, but you may not want that." puts "So I'll let you do that all by yourself." puts puts "You may now run ruby_mem_dump using the patched ruby:" puts puts "\t#{File.join ruby_dir, "ruby_mem_inspect"} -S ruby_mem_dump" puts puts "If you haven't installed mem_inspect:" puts puts "\t#{File.join ruby_dir, "ruby_mem_inspect"} -Ilib bin/ruby_mem_dump" puts puts "*" * 80 end I don't think I can take this any further, alas: I don't know how to get meaningful data about which parts of the code create what in memory, how to find which points of the memory map are salient, and how to extract how these things change with time. Thank you, Hugh