Ticket Created
over 3 years ago

CIQQA-637

repeated makeImageRequest calls cause memory leak

I'm running a widget that makes repeated makeImageRequest calls and am noticing memory consumption go

up by 0.1 to 0.2kB for each call.  Looks like a memory leak. I'm using Connect IQ SDK 4.0.3 and users are reporting out of memory crashes.

I tried the widget app with every watch model in the simulator and the problem occurs on every model except Venu2 and Venu2s.  

Incidentally the widget app under Venu2 and Venu2s takes extremely little memory to run compared to other models.  I'm not sure why.

Parents
  • You are requesting an image every second without checking if there is a request active.  Try moving  triggerRequest() out of timerCallback() and instead do it in responseCallback, so you can't have multiple requests at the same time.

Comment
  • You are requesting an image every second without checking if there is a request active.  Try moving  triggerRequest() out of timerCallback() and instead do it in responseCallback, so you can't have multiple requests at the same time.

Children
  • You can also set a flag in triggerRequest, clear it in reposonceCallback, and in timerRequest, don't call triggerRequest if that flag is set.

    You are assuming that the request will always complete  in less than 1 sec, and that might not always be a valid assumption.