@ Tom
I have 950 MB of free memory while corona is in use.
I think that is plenty but im not sure.
[import]uid: 152065 topic_id: 29608 reply_id: 119685[/import]
@ Tom
I have 950 MB of free memory while corona is in use.
I think that is plenty but im not sure.
[import]uid: 152065 topic_id: 29608 reply_id: 119685[/import]
Tom, I followed exactly the same steps I used on post #12 above, and I also had Activity Monitor turned on. It’s a shame, but the simulator won’t crash anymore (even though I set up my project to exactly how I had it yesterday when testing this.) So I can’t tell the state of memory when the crash happens.
That said, now that it refuses to crash, I have to agree that it could possibly be something to do with memory issue. Today, I was mostly working on this troublesome user-flow, and I have not opened up tons of web-pages or tons of other files on desktop yet (so not much is using up the memory.)
I’ll post back if/when I see this crash again (and will turn the Activity Monitor on as soon as I experience the crash.)
Naomi [import]uid: 67217 topic_id: 29608 reply_id: 119687[/import]
Thanks everyone for the replies.
We have found that the amount of memory consumed for each Corona reload is dependent on which skin you’re using. The iPhone skin takes the least and iPad Retina, the most. We are still hunting down the code causing this.
Closing tabs in Safari will give you back more system RAM. Closing and restarting Safari will help too.
@davidgmonical, with only 950 MB free, reloading Corona with the iPad Rentia skin will consume half of that memory in about 10 reloads. You will start seeing things slow down and getting “beach balls” when you are running low on memory.
-Tom [import]uid: 7559 topic_id: 29608 reply_id: 119689[/import]
FYI, the new Mac Daily Build (883) that just went up has a bunch of workarounds/rewrites for this problem plus some long requested features of being able to turn off the skinned windows, disable auto zoom and remember your last zoom level, and re-center a window.
Please try it out and let us know how it works.
[import]uid: 7563 topic_id: 29608 reply_id: 120432[/import]
Thanks Tom,
I found a way around this by setting the Relaunch Simulator when project Is modified in the Preferences to Never and just relaunching each time… a lot faster than having to reopen everything after it crashes. [import]uid: 152065 topic_id: 29608 reply_id: 119712[/import]
FYI, the next build (884) will contain a few more minor bug fixes for dealing zooming and orientation changes while in fullscreen plus a math fix for relaunching windows at their previous scale when the scale is 1/8th.
[import]uid: 7563 topic_id: 29608 reply_id: 120563[/import]
FYI, we tracked down the problem to a pretty serious memory leak in Apple’s IKImageView implementation. Unfortunately, since it is an Apple bug (radar://12106230), it is a nontrivial thing to fix/workaround. We are still working on this, but don’t have an ETA yet.
[import]uid: 7563 topic_id: 29608 reply_id: 119927[/import]
David, thanks for the idea, sure lot faster than reopening after crash.
Ewing, this memory leak that has been identified now. Is it linked to Mountain Lion or do it also appear in Snow Leopard? Good to know if I want to go the downgrade route [import]uid: 37802 topic_id: 29608 reply_id: 119930[/import]
David, thanks for the idea, sure lot faster than reopening after crash.
Ewing, this memory leak that has been identified now. Is it linked to Mountain Lion or do it also appear in Snow Leopard? Good to know if I want to go the downgrade route [import]uid: 37802 topic_id: 29608 reply_id: 119931[/import]
Nice to hear you are making progress after all
[import]uid: 126729 topic_id: 29608 reply_id: 119928[/import]
The memory link is not tied to an OS version but tied to a Image class we are using to display the skin that is internal to Corona. The problem has been around for a while and I think Mt. Lion consumes more memory which makes the problem show up more often. [import]uid: 7559 topic_id: 29608 reply_id: 119937[/import]
We verified the problem exists in 10.7 and 10.8. We don’t know about 10.6, but assume it exists there too. Google hits for this problem reveal others have hit memory leaks but no real details. I suspect they never filed Apple radars on this so this never got fixed. (I mirrored ours on Open Radar if anybody wants to see.) Apple made Core Animation even more multithreaded for performance behind the scenes in 10.8 which probably made this problem worse on 10.8 since this seems to be a race condition bug.
We do not recommend downgrading to 10.6 (or downgrading at all). 10.6’s days are numbered and we will likely be dropping compatibility support for it in the near future. (You can’t get an Xcode that supports iOS 5.1 for it because Apple has already dropped support for it.)
[import]uid: 7563 topic_id: 29608 reply_id: 119941[/import]
Thanks fot the info. Clear things. Well, then it’s time to move my real workcomputer onwards to 10.8.
(I just hope that people will learn to hack into ML to remove more of all those totally worthless animations and effect that slow down any serious production environment. I want to work, not look a animations that wastes my time)
[import]uid: 37802 topic_id: 29608 reply_id: 119945[/import]
FYI, the new Mac Daily Build (883) that just went up has a bunch of workarounds/rewrites for this problem plus some long requested features of being able to turn off the skinned windows, disable auto zoom and remember your last zoom level, and re-center a window.
Please try it out and let us know how it works.
[import]uid: 7563 topic_id: 29608 reply_id: 120432[/import]
FYI, the next build (884) will contain a few more minor bug fixes for dealing zooming and orientation changes while in fullscreen plus a math fix for relaunching windows at their previous scale when the scale is 1/8th.
[import]uid: 7563 topic_id: 29608 reply_id: 120563[/import]
I have the same problem.
/Applications/CoronaSDK/Corona Terminal: line 9: 46317 Segmentation fault: 11 “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*
I’m sure this is the simulator’s problem.
Because the same code works fine with the real iPhone and Android Device.
Simulator’s build version is 936 and every 9xx version that I have tried crashs the same way.
Is anyway to solve this problem?
[import]uid: 104920 topic_id: 29608 reply_id: 128562[/import]
Do any of the sample apps crash or only your code?
If it’s only your code, I bet there is a problem in your code that is causing the simulator to crash. It’s possible for the simulator to crash because your code is not doing something correct and not have it crash on the device. You may find that it’s not working correctly on the device without crashing.
Have you looked at the Xcode console when running your code on the iPhone? You may find it gives you some error messages.
The only other way to track down the problem is to file a bug report and submit your project or sample code that shows the problem.
The simulator shouldn’t crash, but that are some things you can do in code that will make it happen. We try to fix it when we know about it, but I’m sure there are still some things that will cause a crash.
It’s rare to have a bug in the simulator that causes it to crash and not have it crash or show up as a problem on the device.
[import]uid: 7559 topic_id: 29608 reply_id: 128563[/import]
I have the same problem.
/Applications/CoronaSDK/Corona Terminal: line 9: 46317 Segmentation fault: 11 “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*
I’m sure this is the simulator’s problem.
Because the same code works fine with the real iPhone and Android Device.
Simulator’s build version is 936 and every 9xx version that I have tried crashs the same way.
Is anyway to solve this problem?
[import]uid: 104920 topic_id: 29608 reply_id: 128562[/import]
Do any of the sample apps crash or only your code?
If it’s only your code, I bet there is a problem in your code that is causing the simulator to crash. It’s possible for the simulator to crash because your code is not doing something correct and not have it crash on the device. You may find that it’s not working correctly on the device without crashing.
Have you looked at the Xcode console when running your code on the iPhone? You may find it gives you some error messages.
The only other way to track down the problem is to file a bug report and submit your project or sample code that shows the problem.
The simulator shouldn’t crash, but that are some things you can do in code that will make it happen. We try to fix it when we know about it, but I’m sure there are still some things that will cause a crash.
It’s rare to have a bug in the simulator that causes it to crash and not have it crash or show up as a problem on the device.
[import]uid: 7559 topic_id: 29608 reply_id: 128563[/import]
This code is breaking my simulator with a similar error.
display.setStatusBar( display.HiddenStatusBar )
– Your code here
local taskManager = require(“taskmgr”)
widget = require “widget”
– Set the widget theme
widget.setTheme( “theme_ios” )
local widgetHelper = require(“widgethelper”)
local btnDeleteRow = nil
local pageList = display.newGroup()
local pageEdit = display.newGroup()
taskManager.addTask(taskManager.makeTask(“take out laundry”))
taskManager.addTask(taskManager.makeTask(“wash the trash”))
taskManager.addNewTask(“eat the dishes”)
print(tostring(#taskManager.taskList))
taskManager.debugTaskDescs()
pageList:insert( widgetHelper.makeTitleBar(0,“To Do App”) )
pageEdit:insert( widgetHelper.makeTitleBar(0,“Edit Task”) )
local list = widget.newTableView{
top = 44,
height = 366,
maskFile = “assets/mask-320x366.png”
}
pageList:insert(list)
local function onDeletePress(event)
–booooo
if(event.phase == “release”) then
local r = event.target.rowNum
print(tostring®)
taskManager.deleteTask®
list:deleteRow®
end
return true
end
– function below handles row touches, swipes, etc.
local function onRowTouch( event )
print (“row touched:” … event.phase)
local row = event.target–event.row
local text = row.textObj
local rowNum = event.index
– if event.phase == “press” or event.phase == “tap” then
– if text then
– text.text = "Touched row with id " … row.id
– end
– elseif event.phase == “swipeLeft” then
– if text then
– text.text = “Swiped row " … event.index … " LEFT.”
– end
if(event.phase == “tap”) then
pageList.isVisible = false
pageEdit.isVisible = true
elseif event.phase == “swipeRight” then
– create a delete button and then add it to the view of the row
if(btnDeleteRow ~= nil) then
btnDeleteRow:removeSelf()
end
btnDeleteRow = widgetHelper.addDeleteButton(0,0,onDeletePress)
btnDeleteRow.rowNum = rowNum
event.view:insert(btnDeleteRow)
btnDeleteRow:setReferencePoint(display.CenterRightReferencePoint)
btnDeleteRow.y = row.height * 0.5
btnDeleteRow.x = row.width - 10
if text then
text.text = “Swiped row " … event.index … " RIGHT.”
end
end
– elseif event.phase == “release” then
– -- force row re-render on next TableView update
– row.reRender = true
– end
– reposition text
if text then
text:setReferencePoint( display.CenterLeftReferencePoint )
text.x = 25
text.y = row.height * 0.5
end
end
– function below handles row rendering
local function onRowRender( event )
local group = event.view
local row = event.target
local taskNum = event.index
local desc = taskManager.getTaskDescription(taskNum)
local text = display.newText( desc, 0, 0, native.systemFont, 18 )
text:setReferencePoint( display.CenterLeftReferencePoint )
text:setTextColor(0,0,255)
text.x = 25
text.y = row.height * 0.5
– you must insert any display objects into event.view group
group:insert( text )
end
local addTaskButtonEvent = function(event)
if event.phase == “release” then
taskManager.addNewTask(“new task”)
– insert the row
list:insertRow({
id = “unique-row-id”,
onRender = onRowRender,
onEvent = onRowTouch
})
taskManager.debugTaskDescs()
end
end
local button = widgetHelper.addButton(“Add task”, 40, display.contentHeight - 60, addTaskButtonEvent)
pageList:insert(button)
if(taskManager.getNumTasks() > 0) then
for i = 1,taskManager.getNumTasks() do
– insert the row
list:insertRow({
id = “unique-row-id”,
onRender = onRowRender,
onEvent = onRowTouch
})
end
end
pageEdit.isVisible = false
txtTaskDesc = widgetHelper.makeTextField(80, “desc”, “blah”, nil)
pageEdit:insert(txtTaskDesc)
[/lua]
local w = {}
local function makeTitleBar(yloc, label)
– create a gradient for the top-half of the toolbar
local group = display.newGroup()
local toolbarGradient = graphics.newGradient( {168, 181, 198, 255 }, {139, 157, 180, 255}, “down” )
– create toolbar to go at the top of the screen
local titleBar = widget.newTabBar{
top = yloc, – !!! CHANGED THIS TO AN ARGUMENT !!!
gradient = toolbarGradient,
bottomFill = { 117, 139, 168, 255 },
height = 44
}
group:insert(titleBar)
– create embossed text to go on toolbar !!! CHANGED TEXT TO ARGUMENT !!!
local titleText = display.newEmbossedText( label, 0, 0, native.systemFontBold, 20 )
titleText:setReferencePoint( display.CenterReferencePoint )
titleText:setTextColor( 255 )
titleText.x = 160
titleText.y = titleBar.y
group:insert(titleText)
– create a shadow underneath the titlebar (for a nice touch)
local shadow = display.newImage( “assets/shadow.png” )
shadow:setReferencePoint( display.TopLeftReferencePoint )
shadow.x = 0
shadow.y = (44+yloc)
shadow.xScale = 320 / shadow.contentWidth
shadow.alpha = 0.45
group:insert(shadow)
return group
end
w.makeTitleBar = makeTitleBar
–[[
call with a table that specifies at LEAST
label = “Add Task”,
left = 40, – # of px in from the left
top = display.contentHeight - 60,
onEvent = addTaskButtonEvent
–]]
local function addButton( btnLabel, btnLeft, btnTop, btnEventHandler )
tblButtonAttributes = {}
tblButtonAttributes.width = 150
tblButtonAttributes.height = 30
tblButtonAttributes.cornerRadius = 5
tblButtonAttributes.emboss = true
tblButtonAttributes.label = btnLabel
tblButtonAttributes.left = btnLeft
tblButtonAttributes.top = btnTop
tblButtonAttributes.onEvent = btnEventHandler
local button = widget.newButton(tblButtonAttributes)
return button
end
w.addButton = addButton
local function addDeleteButton( btnLeft, btnTop, btnEventHandler )
tblButtonAttributes = {}
tblButtonAttributes.width = 60
tblButtonAttributes.height = 30
tblButtonAttributes.cornerRadius = 5
tblButtonAttributes.emboss = true
tblButtonAttributes.label = “Delete”
tblButtonAttributes.left = btnLeft
tblButtonAttributes.top = btnTop
tblButtonAttributes.onEvent = btnEventHandler
– THIS IS THE THING THAT MAKES IT RED
tblButtonAttributes.style = “redLarge”
local button = widget.newButton(tblButtonAttributes)
return button
end
w.addDeleteButton = addDeleteButton
local function makeTextField(yLoc, strLabel, tbDefault, submitHandler)
– should be the right font and the right size, so…
local gap = 10
local xGap = 10
local label = display.newText( strLabel, xGap, yLoc, native.systemFontBold, 20 )
local field = native.newTextField( xGap, yLoc + label.height + gap, display.contentWidth - (2*xGap) , 30 )
field.font = native.newFont( native.systemFontBold, 18 )
local function editTaskDesc( event )
if ( “began” == event.phase ) then
– This is the “keyboard has appeared” event
– In some cases you may want to adjust the interface when the keyboard appears.
elseif ( “ended” == event.phase ) then
– This event is called when the user stops editing a field: for example, when they touch a different field
elseif ( “editing” == event.phase ) then
elseif ( “submitted” == event.phase ) then
– This event occurs when the user presses the “return” key (if available) on the onscreen keyboard
print( field.text )
submitHandler(event)
– Hide keyboard
native.setKeyboardFocus( nil )
end
end
field:addEventListener( “userInput”, editTaskDesc)
field.text = tbDefault – set default text
local grp = display.newGroup()
grp:insert(field)
grp:insert(label)
return grp
end
w.makeTextField = makeTextField
local t = {
taskList = {}
}
local function makeTask(desc)
local task = {
description = desc,
dateDue = 0,
dateRecorded = 0,
category = “”,
priority = 0,
notes = “”
}
return task
end
t.makeTask = makeTask
local function addTask(task)
–adds the new task to the end of the task list
t.taskList[#t.taskList+1] = task
end
t.addTask = addTask
local function addNewTask(desc)
local tmp = makeTask(desc)
addTask(tmp)
end
t.addNewTask = addNewTask
local function debugTaskDescs()
– go through every entry in taskList and print the description
for i = 1, #t.taskList do
print(t.taskList[i].description)
end
end
t.debugTaskDescs = debugTaskDescs
local function getTaskDescription(taskNum)
return t.taskList[taskNum].description
end
t.getTaskDescription = getTaskDescription
local function getNumTasks()
return #t.taskList
end
t.getNumTasks = getNumTasks
local function deleteTask(taskNum)
table.remove(t.taskList,taskNum)
end
t.deleteTask = deleteTask
return t
[/lua] [import]uid: 138235 topic_id: 29608 reply_id: 145349[/import]