Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class EventTestClass
- def initialize()
- begin
- #the next line accesses dbase and seems to cause the memory bloat after many runs of the Testwheel object
- #is there a better way to resolve this?
- result = Articles.find(:all, :select => "id, article_title, article_text", :conditions => "assigned = 'love'", :order => "last_used ASC", :limit => 1 )
- #result = Articles.find_by_id(3193)
- puts result.inspect
- rescue => err
- puts "Get Articles Error: #{err.message}"
- end
- end
- end
- class TestWheel
- def initialize()
- end
- @@threads = nil
- def init_threads()
- if !@@threads then
- puts "HEY NOW INITING WORK QUEUE CLASS VAR!"
- @@threads = WorkQueue.new(25)
- end
- end
- def run_events
- puts "running new linkwheel loop"
- init_threads()
- 100.times do
- @@threads.enqueue_b {
- eventer = EventTestClass.new()
- }
- end
- @@threads.join
- end
- end
- class MemLeakTester
- def initialize()
- end
- def run()
- JRuby.objectspace=true
- while (true) do
- wheel = TestWheel.new()
- wheel.run_events
- sleep(3)
- end
- end
- end
- puts "starting mem tester"
- mem = MemLeakTester.new()
- mem.run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement