Created
January 13, 2011 17:54
-
-
Save shageman/778291 to your computer and use it in GitHub Desktop.
Memory (and classes) leak in neo4jrb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m | |
# Profile these different versions (e.g. with VisualVM) | |
# jruby 1.5.6: watch the number of classes rise with every iteration. Eventually PermGen space will be exhausted. | |
# jruby 1.6.0.rc1: the classes get garbage collected regularly. | |
require "rubygems" | |
require 'neo4j' #1.0.0.beta.26 | |
class Node | |
include Neo4j::NodeMixin | |
property :user_id | |
has_n(:contacts) | |
end | |
node1 = nil | |
Neo4j::Transaction.run do | |
node1 = Node.new(:user_id => 1) | |
end | |
for node_id in 2..100000 | |
Neo4j::Transaction.run do | |
node = Node.new(:user_id => node_id) | |
node.contacts << node1 | |
puts node.contacts.include?(node1) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment