*I'm finding that accessor methods on a wrapped C++ class end up creating
extra objects on the Ruby side. Here's an example to illustrate:
The following Ruby code uses two wrapped C++ classes (Point and Edge) in
the shared library TSP.so. An
Edge has two Point objects and the 'start_node' and 'end_node' methods on
Edge return Point objects.
#test_point.rb
require 'TSP'
include TSP
def count_points
np = 0
ObjectSpace.each_object(Point){|p|
np+=1
}
np
end
pa = Point.new(2,3)
pb = Point.new(10,6)
puts "number of points should be 2: count_points=#{count_points}"
edge = Edge.new(pa,pb,(pa-pb))
puts "number of points should be 2: count_points=#{count_points}"
puts edge.start_node ...*

## Bookmarks