The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
mem_inspect and png

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Hodel

Posts: 660
Nickname: drbrain
Registered: Mar, 2006

Eric Hodel is a long-time Rubyist and co-founder of Seattle.rb.
mem_inspect and png Posted: Sep 1, 2006 1:13 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eric Hodel.
Original Post: mem_inspect and png
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eric Hodel
Latest Posts From Segment7

Advertisement

I'm pleased to announce to new libraries written by members of the Seattle Ruby Brigade, mem_inspect and png!

mem_inspect

mem_inspect is ObjectSpace.each_object on crack. mem_inspect gives you the contents of each slot in Ruby's heap. mem_inspect also includes viewers that let you visualize the contents of Ruby's heap.

To install:

sudo gem install mem_inspect

Then you'll need to build a patched ruby:

ruby_mem_inspect_build

You'll then have a ruby capable of running mem_inspect in mem_inspect_ruby_1_8.

You can make an image with:

mem_inspect_ruby_1_8/ruby_mem_inspect -S ruby_mem_dump

Which will give you a PNG in your current directory named: mem_inspect.PID.TIMESTAMP.png

You'll get an image that looks something like this:

http://flickr.com/photos/drbrain/229482312/

Bigger:

http://flickr.com/photo_zoom.gne?id=229482312&size=o

To dump a PDF any time you want:

require 'meminspect/png_viewer'

MemInspect::PNGViewer.new(1024, 768).draw

You can also dump to an AquaTerm plot window if you have RubyCocoa and AquaTerm installed.

require 'meminspect/aquaterm_viewer'

MemInspect::AquatermViewer.new(1024, 768).draw

png

png is a pure-ruby PNG writing library written by Ryan Davis.

To install:

sudo gem install png

To use:

require 'png'

canvas = PNG::Canvas.new 200, 200

# Set a point to a color
canvas[100, 100] = PNG::Color::Black

# draw an anti-aliased line
canvas.line 50, 50, 100, 50, PNG::Color::Blue

png = PNG.new canvas
png.save 'blah.png'

Read: mem_inspect and png

Topic: Memory Map Previous Topic   Next Topic Topic: The Sandbox is Loading Gems and Acting Less Freaky

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use