GitHub PullRequestEvent at 2014-06-17 17:10:39
Repository: apptentive-android
Actor: solcott
Payload: {"action":"opened","number":85,"pull_request":{"url":"https://api.github.com/repos/apptentive/apptentive-android/pulls/85","id":17248705,"html_url":"https://github.com/apptentive/apptentive-android/pull/85","diff_url":"https://github.com/apptentive/apptentive-android/pull/85.diff","patch_url":"https://github.com/apptentive/apptentive-android/pull/85.patch","issue_url":"https://api.github.com/repos/apptentive/apptentive-android/issues/85","number":85,"state":"open","title":"Fix memory leak caused by passing activity context to new Thread","user":{"login":"solcott","id":547325,"avatar_url":"https://avatars.githubusercontent.com/u/547325?","gravatar_id":"3ea7ebbdb8378154fa13c5fe90f1412d","url":"https://api.github.com/users/solcott","html_url":"https://github.com/solcott","followers_url":"https://api.github.com/users/solcott/followers","following_url":"https://api.github.com/users/solcott/following{/other_user}","gists_url":"https://api.github.com/users/solcott/gists{/gist_id}","starred_url":"https://api.github.com/users/solcott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solcott/subscriptions","organizations_url":"https://api.github.com/users/solcott/orgs","repos_url":"https://api.github.com/users/solcott/repos","events_url":"https://api.github.com/users/solcott/events{/privacy}","received_events_url":"https://api.github.com/users/solcott/received_events","type":"User","site_admin":false},"body":"Passing the Activity Context to new a Thread is causing a memory leak. \r\n\r\nTo reproduce the leak on ICS or higher add  StrictMode.enableDefaults() to your Application or Activities onCreate.  After starting the app rotate the device a few times.  You we see something similar to  \r\nandroid.os.StrictMode$InstanceCountViolation: class Your com.example.YourActivity; instances=2; limit=1 in logcat.  After every device rotation instances will increment.  After a few device rotations you can do a heap dump and then import in into MAT.\r\n\r\nOnce you have imported the heap dump into MAT got the histogram and search for your activity.  Select it and  right click on it go to Merge Shortest Paths to GC Roots -> exclude all weak references and you will see something similar the following\r\n![screen shot 2014-06-17 at 11 02 49 am](https://cloud.githubusercontent.com/assets/547325/3303610/4f4d5a46-f641-11e3-8aed-49479fc7ac90.png)\r\n\r\n\r\nThere should only be on instance in memory","created_at":"2014-06-17T17:10:38Z","updated_at":"2014-06-17T17:10:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apptentive/apptentive-android/pulls/85/commits","review_comments_url":"https://api.github.com/repos/apptentive/apptentive-android/pulls/85/comments","review_comment_url":"https://api.github.com/repos/apptentive/apptentive-android/pulls/comments/{number}","comments_url":"https://api.github.com/repos/apptentive/apptentive-android/issues/85/comments","statuses_url":"https://api.github.com/repos/apptentive/apptentive-android/statuses/86d51f000f0654b1e117a7585675d6ad2899813e","head":{"label":"solcott:master","ref":"master","sha":"86d51f000f0654b1e117a7585675d6ad2899813e","user":{"login":"solcott","id":547325,"avatar_url":"https://avatars.githubusercontent.com/u/547325?","gravatar_id":"3ea7ebbdb8378154fa13c5fe90f1412d","url":"https://api.github.com/users/solcott","html_url":"https://github.com/solcott","followers_url":"https://api.github.com/users/solcott/followers","following_url":"https://api.github.com/users/solcott/following{/other_user}","gists_url":"https://api.github.com/users/solcott/gists{/gist_id}","starred_url":"https://api.github.com/users/solcott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solcott/subscriptions","organizations_url":"https://api.github.com/users/solcott/orgs","repos_url":"https://api.github.com/users/solcott/repos","events_url":"https://api.github.com/users/solcott/events{/privacy}","received_events_url":"https://api.github.com/users/solcott/received_events","type":"User","site_admin":false},"repo":{"id":20931051,"name":"apptentive-android","full_name":"solcott/apptentive-android","owner":{"login":"solcott","id":547325,"avatar_url":"https://avatars.githubusercontent.com/u/547325?","gravatar_id":"3ea7ebbdb8378154fa13c5fe90f1412d","url":"https://api.github.com/users/solcott","html_url":"https://github.com/solcott","followers_url":"https://api.github.com/users/solcott/followers","following_url":"https://api.github.com/users/solcott/following{/other_user}","gists_url":"https://api.github.com/users/solcott/gists{/gist_id}","starred_url":"https://api.github.com/users/solcott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solcott/subscriptions","organizations_url":"https://api.github.com/users/solcott/orgs","repos_url":"https://api.github.com/users/solcott/repos","events_url":"https://api.github.com/users/solcott/events{/privacy}","received_events_url":"https://api.github.com/users/solcott/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/solcott/apptentive-android","description":"Apptentive Android SDK","fork":true,"url":"https://api.github.com/repos/solcott/apptentive-android","forks_url":"https://api.github.com/repos/solcott/apptentive-android/forks","keys_url":"https://api.github.com/repos/solcott/apptentive-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solcott/apptentive-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solcott/apptentive-android/teams","hooks_url":"https://api.github.com/repos/solcott/apptentive-android/hooks","issue_events_url":"https://api.github.com/repos/solcott/apptentive-android/issues/events{/number}","events_url":"https://api.github.com/repos/solcott/apptentive-android/events","assignees_url":"https://api.github.com/repos/solcott/apptentive-android/assignees{/user}","branches_url":"https://api.github.com/repos/solcott/apptentive-android/branches{/branch}","tags_url":"https://api.github.com/repos/solcott/apptentive-android/tags","blobs_url":"https://api.github.com/repos/solcott/apptentive-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solcott/apptentive-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solcott/apptentive-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/solcott/apptentive-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solcott/apptentive-android/statuses/{sha}","languages_url":"https://api.github.com/repos/solcott/apptentive-android/languages","stargazers_url":"https://api.github.com/repos/solcott/apptentive-android/stargazers","contributors_url":"https://api.github.com/repos/solcott/apptentive-android/contributors","subscribers_url":"https://api.github.com/repos/solcott/apptentive-android/subscribers","subscription_url":"https://api.github.com/repos/solcott/apptentive-android/subscription","commits_url":"https://api.github.com/repos/solcott/apptentive-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/solcott/apptentive-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/solcott/apptentive-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/solcott/apptentive-android/issues/comments/{number}","contents_url":"https://api.github.com/repos/solcott/apptentive-android/contents/{+path}","compare_url":"https://api.github.com/repos/solcott/apptentive-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solcott/apptentive-android/merges","archive_url":"https://api.github.com/repos/solcott/apptentive-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solcott/apptentive-android/downloads","issues_url":"https://api.github.com/repos/solcott/apptentive-android/issues{/number}","pulls_url":"https://api.github.com/repos/solcott/apptentive-android/pulls{/number}","milestones_url":"https://api.github.com/repos/solcott/apptentive-android/milestones{/number}","notifications_url":"https://api.github.com/repos/solcott/apptentive-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solcott/apptentive-android/labels{/name}","releases_url":"https://api.github.com/repos/solcott/apptentive-android/releases{/id}","created_at":"2014-06-17T16:27:13Z","updated_at":"2014-06-17T17:10:38Z","pushed_at":"2014-06-17T16:46:47Z","git_url":"git://github.com/solcott/apptentive-android.git","ssh_url":"git@github.com:solcott/apptentive-android.git","clone_url":"https://github.com/solcott/apptentive-android.git","svn_url":"https://github.com/solcott/apptentive-android","homepage":"http://www.apptentive.com","size":15045,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apptentive:master","ref":"master","sha":"b905589ab10150cafb7821e7e88e550b807cb12c","user":{"login":"apptentive","id":733925,"avatar_url":"https://avatars.githubusercontent.com/u/733925?","gravatar_id":"5b3c2426bc3088c0011671ec18e1cebf","url":"https://api.github.com/users/apptentive","html_url":"https://github.com/apptentive","followers_url":"https://api.github.com/users/apptentive/followers","following_url":"https://api.github.com/users/apptentive/following{/other_user}","gists_url":"https://api.github.com/users/apptentive/gists{/gist_id}","starred_url":"https://api.github.com/users/apptentive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apptentive/subscriptions","organizations_url":"https://api.github.com/users/apptentive/orgs","repos_url":"https://api.github.com/users/apptentive/repos","events_url":"https://api.github.com/users/apptentive/events{/privacy}","received_events_url":"https://api.github.com/users/apptentive/received_events","type":"Organization","site_admin":false},"repo":{"id":2466190,"name":"apptentive-android","full_name":"apptentive/apptentive-android","owner":{"login":"apptentive","id":733925,"avatar_url":"https://avatars.githubusercontent.com/u/733925?","gravatar_id":"5b3c2426bc3088c0011671ec18e1cebf","url":"https://api.github.com/users/apptentive","html_url":"https://github.com/apptentive","followers_url":"https://api.github.com/users/apptentive/followers","following_url":"https://api.github.com/users/apptentive/following{/other_user}","gists_url":"https://api.github.com/users/apptentive/gists{/gist_id}","starred_url":"https://api.github.com/users/apptentive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apptentive/subscriptions","organizations_url":"https://api.github.com/users/apptentive/orgs","repos_url":"https://api.github.com/users/apptentive/repos","events_url":"https://api.github.com/users/apptentive/events{/privacy}","received_events_url":"https://api.github.com/users/apptentive/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apptentive/apptentive-android","description":"Apptentive Android SDK","fork":false,"url":"https://api.github.com/repos/apptentive/apptentive-android","forks_url":"https://api.github.com/repos/apptentive/apptentive-android/forks","keys_url":"https://api.github.com/repos/apptentive/apptentive-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apptentive/apptentive-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apptentive/apptentive-android/teams","hooks_url":"https://api.github.com/repos/apptentive/apptentive-android/hooks","issue_events_url":"https://api.github.com/repos/apptentive/apptentive-android/issues/events{/number}","events_url":"https://api.github.com/repos/apptentive/apptentive-android/events","assignees_url":"https://api.github.com/repos/apptentive/apptentive-android/assignees{/user}","branches_url":"https://api.github.com/repos/apptentive/apptentive-android/branches{/branch}","tags_url":"https://api.github.com/repos/apptentive/apptentive-android/tags","blobs_url":"https://api.github.com/repos/apptentive/apptentive-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apptentive/apptentive-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apptentive/apptentive-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/apptentive/apptentive-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apptentive/apptentive-android/statuses/{sha}","languages_url":"https://api.github.com/repos/apptentive/apptentive-android/languages","stargazers_url":"https://api.github.com/repos/apptentive/apptentive-android/stargazers","contributors_url":"https://api.github.com/repos/apptentive/apptentive-android/contributors","subscribers_url":"https://api.github.com/repos/apptentive/apptentive-android/subscribers","subscription_url":"https://api.github.com/repos/apptentive/apptentive-android/subscription","commits_url":"https://api.github.com/repos/apptentive/apptentive-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/apptentive/apptentive-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/apptentive/apptentive-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/apptentive/apptentive-android/issues/comments/{number}","contents_url":"https://api.github.com/repos/apptentive/apptentive-android/contents/{+path}","compare_url":"https://api.github.com/repos/apptentive/apptentive-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apptentive/apptentive-android/merges","archive_url":"https://api.github.com/repos/apptentive/apptentive-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apptentive/apptentive-android/downloads","issues_url":"https://api.github.com/repos/apptentive/apptentive-android/issues{/number}","pulls_url":"https://api.github.com/repos/apptentive/apptentive-android/pulls{/number}","milestones_url":"https://api.github.com/repos/apptentive/apptentive-android/milestones{/number}","notifications_url":"https://api.github.com/repos/apptentive/apptentive-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apptentive/apptentive-android/labels{/name}","releases_url":"https://api.github.com/repos/apptentive/apptentive-android/releases{/id}","created_at":"2011-09-27T07:51:41Z","updated_at":"2014-06-15T14:38:30Z","pushed_at":"2014-05-27T22:56:26Z","git_url":"git://github.com/apptentive/apptentive-android.git","ssh_url":"git@github.com:apptentive/apptentive-android.git","clone_url":"https://github.com/apptentive/apptentive-android.git","svn_url":"https://github.com/apptentive/apptentive-android","homepage":"http://www.apptentive.com","size":15045,"stargazers_count":27,"watchers_count":27,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":35,"mirror_url":null,"open_issues_count":8,"forks":35,"open_issues":8,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apptentive/apptentive-android/pulls/85"},"html":{"href":"https://github.com/apptentive/apptentive-android/pull/85"},"issue":{"href":"https://api.github.com/repos/apptentive/apptentive-android/issues/85"},"comments":{"href":"https://api.github.com/repos/apptentive/apptentive-android/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/apptentive/apptentive-android/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/apptentive/apptentive-android/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/apptentive/apptentive-android/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/apptentive/apptentive-android/statuses/86d51f000f0654b1e117a7585675d6ad2899813e"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":2,"deletions":2,"changed_files":1}}