(solved) frame rate drops every seven seconds

I am having an issue across all multiple devices that run my app at various frame rates. What I am seeing is that every 7 seconds the frame rate of my app drops by 50%. For example if it runs at 40 fps on one device it dips to 20 fps there and if it runs at 30 fps on another device it drops to 15 fps there. The timing of the fps drop is very precise and I do not have any timers firing callbacks every 7 seconds so I am baffled. Has anyone seen anything like this before?

*EDIT* The corona simulator does not display this issue. It happens on both android and iOS devices as well as the xcode simulator.

*SOLVED* garbage collection was causing the frame rate drops [import]uid: 100558 topic_id: 19352 reply_id: 319352[/import]

You can try to test it in Xcode and progress log can tell you if something is wrong with your app [import]uid: 16142 topic_id: 19352 reply_id: 74704[/import]

I’ve tried running it in the xcode simulator and see the problem, but no errors print out to the terminal. I’m not sure exactly what you mean by progress log, is there something else I could be checking?

Thanks! [import]uid: 100558 topic_id: 19352 reply_id: 74744[/import]

It may not be an error as such but rather you doing a whole lot of stuff at once - how “busy” is your app? (What’s the texture and memory usage like?)

Peach :slight_smile: [import]uid: 52491 topic_id: 19352 reply_id: 74877[/import]

I’m using 29mb of texture memory. The game does this even in its idle state. In this state I’m doing the same thing every frame except for every 5 seconds I change a font’s text string. [import]uid: 100558 topic_id: 19352 reply_id: 74972[/import]

What does your Runtime listener actually do and what devices are you testing on? That’s a big drop however if one device is a 3GS I wouldn’t be surprised with that texture memory usage. (Safe for 3GS seems to be up to 25MB, no higher.)

Peach :slight_smile: [import]uid: 52491 topic_id: 19352 reply_id: 75004[/import]

The devices that I am testing on are the Galaxy Tab 10.1 and the iPad. The only Runtime listener that I have drives my games update loop on the enterFrame event. I’m using sprite sheets for all of my graphics static or animated. Cutting out assets so that I drop below 20mb of texture memory I still see this issue so I’m not sure that is it. I’m still digging through my stuff to try to find anything that could trigger so precisely timed of an issue.

Thanks for your insight, I know this is not the easy kind of issue to debug with or without the source. [import]uid: 100558 topic_id: 19352 reply_id: 75112[/import]

This is a very weird issue, I’ve never seen it honestly. I suggest you keep digging :frowning:

Just to check, what version of Corona are you using?

We do have premium support ( Link: http://www.anscamobile.com/corona/support/ ) where a member of the team will debug your code and fix issues for you, if you get really stuck.

Sorry I don’t have any magical quick fixes!

Peach :slight_smile: [import]uid: 52491 topic_id: 19352 reply_id: 75214[/import]

I’m using build 2011.696 at this point. I’ll post if I ever figure out what’s causing the issue, but my primary focus at this point is to just boost overall performance up so that the 50% fps hit doesn’t have a noticeable effect on the apps operation.

Thanks again! [import]uid: 100558 topic_id: 19352 reply_id: 75286[/import]

How are you updating that text string? [import]uid: 84637 topic_id: 19352 reply_id: 75364[/import]

Sorry for the delay in my response to your question, I was out of the office for the holidays.

I am setting the text like so:

function SetDisplayString(tempString)  
 fontObject.text = tempString  
end  
  
SetDisplayString("Press play to win!")  

As an update I noticed that there is a new stable build out that is newer than the daily build I was using so I have updated to that and will do some more testing to see if I still have this issue. [import]uid: 100558 topic_id: 19352 reply_id: 77317[/import]

I still see the dip although the timing has changed, it now dips every 10 seconds instead of every 7. It also no longer seems to have a negative effect on my game. The only thing that seems to be affected still is a slight lag to input, if entered during the dip. In a game that does not require any kind of precision I’m ok with the current state of things. Thanks for all the replies and ideas. [import]uid: 100558 topic_id: 19352 reply_id: 77752[/import]

I was asked to look more into this issue late last week and found that the drop in the frame rate correlated to drops in the value returned by collectgarbage(“count”). So garbage collection is causing this issue and I just need to hunt down and optimize my memory usage. [import]uid: 100558 topic_id: 19352 reply_id: 80433[/import]