From carstep at gmail.com Wed Feb 9 08:55:27 2011 From: carstep at gmail.com (Sanyi) Date: Wed, 9 Feb 2011 14:55:27 +0100 Subject: [Celerity-users] popupbrowser, memory leakage, maybe Message-ID: Hi There, Latest celerity ( if I remember correctly it was 0.8.7 ) and latest JRuby 1.5.6 OSX 10.6.6 ( Java 1.6.... ) I attached a little script where I test if all our product code pages are available ( 1st period, 500+ pages ). The pages are created with Java GWT. I also attached a picture about the jConsole output of our script. It's quite simple script and as I'm mainly a PHP developer it's more difficult to hunt down this memory leakage. Is there anything I missed about click_and_attach? wbr Sandor Ruby file: #************************************************************* require 'java' require 'rubygems' require 'jdbc/mysql' require 'celerity' # Kiszamolja, mennyi lapbol all az aktualis Hitel konstrukcios oldal def calculatePageNumbers ( inputVal ) parseFrom = inputVal.index( "/" ) parseTill = parseFrom + 5 return inputVal[parseFrom + 1..parseTill].to_i - 1 end # Betoltjuk azokat a Eleresi utak cimkejet, amelyekkel dolgozni akarunk def getLinkLabels # For each row returned do some stuff a = Array.new a.push "Szem?lyi k?lcs?n?k" return a end def processTable2 ( tcontent, konstrukcio ) tcontent.tbody.rows.each do |row| if ( row.attribute_value('class') != "extraRow" ) then links = row.links popuplink = nil prodID = nil links.each do |link| if ( link.attribute_value('class') == 'productLink' ) then popuplink = link prodID = link.href.match(/productid=\d+[A-Z_]+\d{4,4}($|[-]\d{3,3})/)[0].split('=')[1] puts prodID end end if ( popuplink != nil ) then popup_browser = popuplink.click_and_attach popup_browser.wait popup_browser.close sleep 1 popup_browser = nil end end end end begin b = Celerity::Browser.new(:resynchronize => true,:render => :xml) b.goto('http://www.pszaf.hu/portal/fogyasztoknak/bal_menu/ptilekerdezo') b.wait linkLabels = getLinkLabels linkLabels.each do |link| puts link b.link(:text, link).click b.wait _div = b.div(:id, "filterTablePlaceholder") nextButton = _div.tables[2].child_row(1).child_cell(5).images[1] # Kinyerem, hogy hany oldalbol all inputValue = _div.tables[2].select_list(:class, "gwt-ListBox").options[0].to_s pages = calculatePageNumbers( inputValue ) tablecontent = nil # Ha 1 -nel tobb, akkor a 'kovetkezo' buttont kell hasznalni a lepteteshez if pages > 0 then # Tablazatot kinyerjuk tablecontent = _div.tables[1] processTable2 tablecontent, link for i in 1..pages nextButton.click b.wait # Tablazatot kinyerjuk tablecontent = _div.tables[1] processTable2 tablecontent, link tablecontent = nil end else # Tablazatot kinyerjuk tablecontent = _div.tables[1] processTable2 tablecontent, link end tablecontent = nil end end #************************************************************* Picture: [IMG]http://i53.tinypic.com/nnp40j.png[/IMG] http://tinypic.com/r/nnp40j/7