Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. class EventTestClass
  2. def initialize()
  3. begin
  4. #the next line accesses dbase and seems to cause the memory bloat after many runs of the Testwheel object
  5. #is there a better way to resolve this?
  6. result = Articles.find(:all, :select => "id, article_title, article_text", :conditions => "assigned = 'love'", :order => "last_used ASC", :limit => 1 )
  7. #result = Articles.find_by_id(3193)
  8. puts result.inspect
  9. rescue => err
  10. puts "Get Articles Error: #{err.message}"
  11. end
  12. end
  13. end
  14.  
  15. class TestWheel
  16. def initialize()
  17. end
  18. @@threads = nil
  19.  
  20. def init_threads()
  21. if !@@threads then
  22. puts "HEY NOW INITING WORK QUEUE CLASS VAR!"
  23. @@threads = WorkQueue.new(25)
  24. end
  25. end
  26.  
  27. def run_events
  28. puts "running new linkwheel loop"
  29. init_threads()
  30. 100.times do
  31. @@threads.enqueue_b {
  32. eventer = EventTestClass.new()
  33. }
  34. end
  35. @@threads.join
  36. end
  37. end
  38.  
  39. class MemLeakTester
  40. def initialize()
  41.  
  42. end
  43.  
  44. def run()
  45. JRuby.objectspace=true
  46.  
  47. while (true) do
  48. wheel = TestWheel.new()
  49. wheel.run_events
  50. sleep(3)
  51. end
  52. end
  53. end
  54. puts "starting mem tester"
  55. mem = MemLeakTester.new()
  56. mem.run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement