Framerate drop on 3GS, almost full speed on simulator and Xcode simulator

I have been having some issues with my iphone 3GS running my app. On the corona simulator and the xcode simulator the app will run at full speed either 30 / 60 fps, I’ve tried both, but on the device the FPS drops to as low as 11 in places. It runs ok for a while then slows down.

I thought it could be a leak but the texture and garbage collection is as below, this is taken every 10 seconds over 2 minutes or so:
Garbage Collection - 324.3408203125
Texture Memory - 5229568
295.1494140625
5229568
283.1162109375
5229568
292.0146484375
5229568
328.728515625
5237760
311.82421875
5237760
302.0498046875
5235712
337.8388671875
5237760
315.9501953125
5237760
311.2177734375
5237760
310.6455078125
5237760
310.9111328125
5237760
315.76953125
5239808
311.03515625
5237760
307.353515625
5237760
305.2841796875
5237760

This all seems ok, I have ran instruments attached to my device and monitored the game, it seems ok.

Just wondering if anybody knows what could be causing the FPS drop? If I set the app to 30FPS then it is alot better, but still drops eventually.

Thanks

Gary
[import]uid: 8699 topic_id: 5970 reply_id: 305970[/import]

I think I just found the issue. I removed the FPS monitor code and the game runs fine on the iphone. Is it usual that fps.lua code causes the iphone to slow down?

thanks [import]uid: 8699 topic_id: 5970 reply_id: 20492[/import]

turns out that the problem wasn’t fixed, just played ok for a while.

After reading some posts on the forum, I thought it could be due to me spawning and destroying lots of objects, each one with a physics body, so I preloaded all the objects I needed.

This method is a bit better but still gives big FPS drops, even though I’m not actually adding anything new to the screen, I’m just moving things.

Does anybody have an idea what could cause this? Could it be my device?

Thanks

This is an example of one of the 4 objects I have preloaded.

[blockcode]
local carA = movieclip.newAnim { “rsturbo.png”, “minigreen.png”, “f40red.png” }
physics.addBody(carA, “kinematic”, {isSensor = true})
carA.x = 50
carA.y = -100
carA.rotation = 90
carA.active = 0
carA.model = 0
carA.choose = 0
carA.lane = 0
carA.collision = onCollision
carA:addEventListener(“collision”,carA)

function carstart(event)

if carA.active == 1 then
if carA.choose == 0 then
timer.performWithDelay(delayRight, rightLane, 1 )
carA.choose = 1
carA.model = math.random(1,3)
if carA.model == 1 then
carA:play{ endFrame = 1, loop = 1}
elseif carA.model == 2 then
carA:play{ endFrame = 2, loop = 1}
elseif carA.model == 3 then
carA:play{ endFrame = 3, loop = 1}
end
end
carA:setLinearVelocity(0,gamespeed)
else
carA:setLinearVelocity(0,0)
carA.y = -100
carA.choose = 0
end
if carA.y > 480 then
local function resetActive()
carA.active = 0
end
timer.performWithDelay(1000,resetActive,1)
end
[/blockcode]
[import]uid: 8699 topic_id: 5970 reply_id: 20703[/import]