SkygearIO / skygear-SDK-Android

Skygear Android SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Potential Memory Leak in Container (context)

chpapa opened this issue · comments

L52-53 in the following file are using context passed from the constructor. In case if the user passes an inappropriate context (such as an ActivityContext), the container will hold it forever.

this.context = context.getApplicationContext();
this.config = config;
this.requestManager = new RequestManager(context, config);
this.persistentStore = new PersistentStore(context);

On L50, this.context is an application context which I guess was suppose to be used instead of context.

So if I understand correctly, we should either:

  1. The container will just use context supplied, and our docs/guides/samples should use context according to the lifecycle of the container; OR
  2. L52-53 should use Application Context (this.context) instead.