{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/comments/88081355","pull_request_review_id":8665948,"id":88081355,"diff_hunk":"@@ -1520,7 +1520,11 @@ namespace Js\n         ScriptContext* scriptContext = instance->GetScriptContext();\n         DynamicType* cachedDynamicType = nullptr;\n         BOOL isJsrtExternalType = instance->GetType()->IsJsrtExternal();\n-        DynamicType* oldType = isJsrtExternalType ? 0 : instance->GetDynamicType();\n+        // Share the type of all JsrtExternal objects which will have 'newPrototype' as their new prototype.\n+        // TypeTransitionMap is a map with key as weakReference and to store it, key need to have a valid heap block.\n+        // So instead of using some constant, use newPrototype as the key for saving newType for such objects\n+        // in TypeTransitionMap.\n+        DynamicType* oldType = isJsrtExternalType ? reinterpret_cast<DynamicType*>(newPrototype) : instance->GetDynamicType();","path":"lib/Runtime/Types/PathTypeHandler.cpp","position":9,"original_position":9,"commit_id":"2fbff122a9b6dd528aecc4c35c8d1819a166e208","original_commit_id":"413e4b755700412bb2ef5285da6e416bcfa5ff01","user":{"login":"kunalspathak","id":12488060,"avatar_url":"https://avatars.githubusercontent.com/u/12488060?v=3","gravatar_id":"","url":"https://api.github.com/users/kunalspathak","html_url":"https://github.com/kunalspathak","followers_url":"https://api.github.com/users/kunalspathak/followers","following_url":"https://api.github.com/users/kunalspathak/following{/other_user}","gists_url":"https://api.github.com/users/kunalspathak/gists{/gist_id}","starred_url":"https://api.github.com/users/kunalspathak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunalspathak/subscriptions","organizations_url":"https://api.github.com/users/kunalspathak/orgs","repos_url":"https://api.github.com/users/kunalspathak/repos","events_url":"https://api.github.com/users/kunalspathak/events{/privacy}","received_events_url":"https://api.github.com/users/kunalspathak/received_events","type":"User","site_admin":false},"body":"I had this concern when I initially implemented it but I didn't find a reason to have separate types for scenarios I was optimizing it for. I will revisit this and see if I can come up with better fix, if needed. Note that this PR doesn't change the original design though except that the key that was being used for `JsrtExternalObject` has been changed  from `0`  to `newPrototype`.","created_at":"2016-11-15T18:29:32Z","updated_at":"2016-11-15T18:29:32Z","html_url":"https://github.com/Microsoft/ChakraCore/pull/1971#discussion_r88081355","pull_request_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/1971","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/comments/88081355"},"html":{"href":"https://github.com/Microsoft/ChakraCore/pull/1971#discussion_r88081355"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/1971"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/1971","id":93053286,"html_url":"https://github.com/Microsoft/ChakraCore/pull/1971","diff_url":"https://github.com/Microsoft/ChakraCore/pull/1971.diff","patch_url":"https://github.com/Microsoft/ChakraCore/pull/1971.patch","issue_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/1971","number":1971,"state":"open","locked":false,"title":"Memory leak fixes","user":{"login":"kunalspathak","id":12488060,"avatar_url":"https://avatars.githubusercontent.com/u/12488060?v=3","gravatar_id":"","url":"https://api.github.com/users/kunalspathak","html_url":"https://github.com/kunalspathak","followers_url":"https://api.github.com/users/kunalspathak/followers","following_url":"https://api.github.com/users/kunalspathak/following{/other_user}","gists_url":"https://api.github.com/users/kunalspathak/gists{/gist_id}","starred_url":"https://api.github.com/users/kunalspathak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunalspathak/subscriptions","organizations_url":"https://api.github.com/users/kunalspathak/orgs","repos_url":"https://api.github.com/users/kunalspathak/repos","events_url":"https://api.github.com/users/kunalspathak/events{/privacy}","received_events_url":"https://api.github.com/users/kunalspathak/received_events","type":"User","site_admin":false},"body":"This PR includes some memory leak fixes.\r\n* Change `FunctionBodyDictionary` and `DeferredFunctionsDictionary` on `Utf8Sourceinfo` to use `LeafValueDictonary`. This will guarantee that references of functionbody stored in these dictionaries does not hold back those function bodies from getting collected.\r\n* Change `TypeTransitionMap` used in type sharing for ChangePrototype to use `WeakReferenceDictionary` so the `DynamicType` references stored in the map does not hold back those types from getting collected. Also added heuristic to periodically remove entries from this map for types that are already collected.","created_at":"2016-11-09T22:42:59Z","updated_at":"2016-11-15T18:29:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df4162e56e012b30b2a17af7c4a4a1f11b053a1e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/1971/commits","review_comments_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/1971/comments","review_comment_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/1971/comments","statuses_url":"https://api.github.com/repos/Microsoft/ChakraCore/statuses/2fbff122a9b6dd528aecc4c35c8d1819a166e208","head":{"label":"kunalspathak:funcbodyleak","ref":"funcbodyleak","sha":"2fbff122a9b6dd528aecc4c35c8d1819a166e208","user":{"login":"kunalspathak","id":12488060,"avatar_url":"https://avatars.githubusercontent.com/u/12488060?v=3","gravatar_id":"","url":"https://api.github.com/users/kunalspathak","html_url":"https://github.com/kunalspathak","followers_url":"https://api.github.com/users/kunalspathak/followers","following_url":"https://api.github.com/users/kunalspathak/following{/other_user}","gists_url":"https://api.github.com/users/kunalspathak/gists{/gist_id}","starred_url":"https://api.github.com/users/kunalspathak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunalspathak/subscriptions","organizations_url":"https://api.github.com/users/kunalspathak/orgs","repos_url":"https://api.github.com/users/kunalspathak/repos","events_url":"https://api.github.com/users/kunalspathak/events{/privacy}","received_events_url":"https://api.github.com/users/kunalspathak/received_events","type":"User","site_admin":false},"repo":{"id":49608132,"name":"ChakraCore","full_name":"kunalspathak/ChakraCore","owner":{"login":"kunalspathak","id":12488060,"avatar_url":"https://avatars.githubusercontent.com/u/12488060?v=3","gravatar_id":"","url":"https://api.github.com/users/kunalspathak","html_url":"https://github.com/kunalspathak","followers_url":"https://api.github.com/users/kunalspathak/followers","following_url":"https://api.github.com/users/kunalspathak/following{/other_user}","gists_url":"https://api.github.com/users/kunalspathak/gists{/gist_id}","starred_url":"https://api.github.com/users/kunalspathak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunalspathak/subscriptions","organizations_url":"https://api.github.com/users/kunalspathak/orgs","repos_url":"https://api.github.com/users/kunalspathak/repos","events_url":"https://api.github.com/users/kunalspathak/events{/privacy}","received_events_url":"https://api.github.com/users/kunalspathak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kunalspathak/ChakraCore","description":"ChakraCore is the core part of the Chakra Javascript engine that powers Microsoft Edge","fork":true,"url":"https://api.github.com/repos/kunalspathak/ChakraCore","forks_url":"https://api.github.com/repos/kunalspathak/ChakraCore/forks","keys_url":"https://api.github.com/repos/kunalspathak/ChakraCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kunalspathak/ChakraCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kunalspathak/ChakraCore/teams","hooks_url":"https://api.github.com/repos/kunalspathak/ChakraCore/hooks","issue_events_url":"https://api.github.com/repos/kunalspathak/ChakraCore/issues/events{/number}","events_url":"https://api.github.com/repos/kunalspathak/ChakraCore/events","assignees_url":"https://api.github.com/repos/kunalspathak/ChakraCore/assignees{/user}","branches_url":"https://api.github.com/repos/kunalspathak/ChakraCore/branches{/branch}","tags_url":"https://api.github.com/repos/kunalspathak/ChakraCore/tags","blobs_url":"https://api.github.com/repos/kunalspathak/ChakraCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kunalspathak/ChakraCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kunalspathak/ChakraCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/kunalspathak/ChakraCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kunalspathak/ChakraCore/statuses/{sha}","languages_url":"https://api.github.com/repos/kunalspathak/ChakraCore/languages","stargazers_url":"https://api.github.com/repos/kunalspathak/ChakraCore/stargazers","contributors_url":"https://api.github.com/repos/kunalspathak/ChakraCore/contributors","subscribers_url":"https://api.github.com/repos/kunalspathak/ChakraCore/subscribers","subscription_url":"https://api.github.com/repos/kunalspathak/ChakraCore/subscription","commits_url":"https://api.github.com/repos/kunalspathak/ChakraCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/kunalspathak/ChakraCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/kunalspathak/ChakraCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/kunalspathak/ChakraCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/kunalspathak/ChakraCore/contents/{+path}","compare_url":"https://api.github.com/repos/kunalspathak/ChakraCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kunalspathak/ChakraCore/merges","archive_url":"https://api.github.com/repos/kunalspathak/ChakraCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kunalspathak/ChakraCore/downloads","issues_url":"https://api.github.com/repos/kunalspathak/ChakraCore/issues{/number}","pulls_url":"https://api.github.com/repos/kunalspathak/ChakraCore/pulls{/number}","milestones_url":"https://api.github.com/repos/kunalspathak/ChakraCore/milestones{/number}","notifications_url":"https://api.github.com/repos/kunalspathak/ChakraCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kunalspathak/ChakraCore/labels{/name}","releases_url":"https://api.github.com/repos/kunalspathak/ChakraCore/releases{/id}","deployments_url":"https://api.github.com/repos/kunalspathak/ChakraCore/deployments","created_at":"2016-01-13T23:07:10Z","updated_at":"2016-01-13T23:07:25Z","pushed_at":"2016-11-11T17:26:10Z","git_url":"git://github.com/kunalspathak/ChakraCore.git","ssh_url":"git@github.com:kunalspathak/ChakraCore.git","clone_url":"https://github.com/kunalspathak/ChakraCore.git","svn_url":"https://github.com/kunalspathak/ChakraCore","homepage":null,"size":44805,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"72ac953b6b864213efa07e884ffa4f375c458e79","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":49086513,"name":"ChakraCore","full_name":"Microsoft/ChakraCore","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/ChakraCore","description":"ChakraCore is the core part of the Chakra Javascript engine that powers Microsoft Edge","fork":false,"url":"https://api.github.com/repos/Microsoft/ChakraCore","forks_url":"https://api.github.com/repos/Microsoft/ChakraCore/forks","keys_url":"https://api.github.com/repos/Microsoft/ChakraCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/ChakraCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/ChakraCore/teams","hooks_url":"https://api.github.com/repos/Microsoft/ChakraCore/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/ChakraCore/events","assignees_url":"https://api.github.com/repos/Microsoft/ChakraCore/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/ChakraCore/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/ChakraCore/tags","blobs_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/ChakraCore/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/ChakraCore/languages","stargazers_url":"https://api.github.com/repos/Microsoft/ChakraCore/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/ChakraCore/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/ChakraCore/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/ChakraCore/subscription","commits_url":"https://api.github.com/repos/Microsoft/ChakraCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/ChakraCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/ChakraCore/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/ChakraCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/ChakraCore/merges","archive_url":"https://api.github.com/repos/Microsoft/ChakraCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/ChakraCore/downloads","issues_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/ChakraCore/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/ChakraCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/ChakraCore/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/ChakraCore/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/ChakraCore/deployments","created_at":"2016-01-05T19:05:31Z","updated_at":"2016-11-15T13:33:45Z","pushed_at":"2016-11-15T17:58:07Z","git_url":"git://github.com/Microsoft/ChakraCore.git","ssh_url":"git@github.com:Microsoft/ChakraCore.git","clone_url":"https://github.com/Microsoft/ChakraCore.git","svn_url":"https://github.com/Microsoft/ChakraCore","homepage":null,"size":62669,"stargazers_count":5740,"watchers_count":5740,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":656,"mirror_url":null,"open_issues_count":192,"forks":656,"open_issues":192,"watchers":5740,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/1971"},"html":{"href":"https://github.com/Microsoft/ChakraCore/pull/1971"},"issue":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/issues/1971"},"comments":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/issues/1971/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/1971/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/1971/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/statuses/2fbff122a9b6dd528aecc4c35c8d1819a166e208"}}}}
{"actor":{"display_login":"kunalspathak"}}