0

No matter how long I leave the app without touching my cpu doesn't drop below 90% or so. I'm using Parse and I've narrowed it down to Bolts using up the cpu. Is this normal? Is there any way to reduce the usage?

I don't believe I have any endless loops that would cause it.

cpu screenshot

instruments screenshot

Jeremiah
  • 1,471
  • 1
  • 13
  • 22

1 Answers1

3

No, that is not normal, and will drain your users’ batteries. An app that does that is definitely not releasable.

It’s impossible to know how to reduce the usage without much more diagnostic info, but it’s well worth the time to track it down.

A starting point could be to pause the offending thread in the debugger while the CPU is pegged, and see what the code is doing. If it’s inside Parse, as your profile screenshot suggests, that won’t tell you much — but sometimes examining the pegged code in the debugger as it executes reveals info that Instruments does not.

Paul Cantrell
  • 9,175
  • 2
  • 40
  • 48
  • Most likely someone is calling Parse much, much, much too often. – gnasher729 Oct 30 '15 at 17:07
  • Thanks for the advice Paul, I've narrowed it down to a function that when commented out drops the CPU to 0%. I'm still not sure why but it has something to do with pinning objects in Parse. – Jeremiah Oct 30 '15 at 17:20
  • For anyone who may come across this I fixed it. I was doing a foreach and pinning each object individually. Parse has a function to append an array of objects at once. Seems like a bug in Parse. – Jeremiah Oct 30 '15 at 17:31