Proper AWS sequence on intermittent WiFi connection + possible memory leak(s)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
EyLa_3227556
Level 3
Level 3
10 replies posted 5 replies posted 10 questions asked

Hello,

My app connects to AWS over WiFi intermittently.

Please advise if the following sequence is correct-

  1. wiced_network_up()
  2. wiced_aws_init()
  3. wiced_aws_create_endpoint()
  4. wiced_aws_connect()
  5. bunch of wiced_aws_subscribe()
  6. bunch of wiced_aws_publish()
  7. wiced_aws_disconnect()
  8. wiced_aws_deinit()
  9. wicefd_network_down()
  10. After X minutes goto 1

Is it possible to shorten reconnection time described above by calling wiced_aws_init()/wiced_aws_create_endpoint() once upon the first connection, or does it have to be called on every (re)connection

Also,

There seem to be a memory leak when calling wiced_aws_disconnect().

At the end of the function there's a call to "free(aws)".

However the parameter  aws that was dynamically allocated in wiced_aws_create_endpoint(), has an internal dynamic allocation (aws->mqtt.base) taking place in aws_internal_mqtt_init() that is not freed when its parent object (aws) is being freed !

Also(2),

Was this reported memory leak handled in the latest SDK? Should I follow the suggested solution in the post?

Your guidelines on how to deal with this use case are highly valuable and appreciated

Thanks

0 Likes
3 Replies