As I have been testing my app and looking at memory stats in Instruments, I saw that when I call a webPopup, my memory usage shoots up about 10MB, but only falls about 2-5MB when it is closed. Is the new web view any better in terms of memory usage? (I assume it is webPopup, not my code, right?) How can I deal with this?
Here is my code (I use the webPopup to open Twitter):
[lua] local TwitterButtonRelease = function(event)
local function escape (s)
s = string.gsub(s, “([&=+%c])”, function ©
return string.format("%%%02X", string.byte©)
end)
s = string.gsub(s, " ", “+”)
return s
end
tweetText = “This is a test tweet from my app!”
local postBody = escape( tweetText )
local theNetwork = theNetwork or “twitter”
if theNetwork == theNetwork or “twitter” then
if highscoreText then
highscoreText.isVisible = false
end
native.showWebPopup(0, 35 + display.screenOriginY, 480, display.contentHeight + 35 + display.screenOriginY, “http://twitter.com/intent/tweet?text=”…postBody)
end
local rectangle = display.newRect(0, 0, 480, 50)
rectangle:setFillColor(0, 0, 0)
local closeButton = ui.newButton{
default = “Images/backButton.png”,
over = “Images/backButtonOver.png”,
–text = “I’m done, close the window!”,
–font = “Trebuchet MS”,
–textColor = { 0, 0, 0, 255 },
–size = 26,
–emboss = true,
}
closeButton.y = 16 + display.screenOriginY
closeButton.x = 40
local closeWindow = function(event)
native.cancelWebPopup()
display.remove(closeButton)
display.remove(rectangle)
if highscoreText then
highscoreText.isVisible = true
end
return true
end
closeButton:addEventListener(“tap”, closeWindow)
return true
end[/lua] [import]uid: 38000 topic_id: 20893 reply_id: 320893[/import]