{"action":"created","comment":{"url":"https://api.github.com/repos/sass/libsass/pulls/comments/91848600","pull_request_review_id":12360463,"id":91848600,"diff_hunk":"@@ -629,42 +636,60 @@ namespace Sass {\n \n \n   // parse root block from includes\n-  Block* Context::compile()\n-  {\n+  Block_Obj Context::compile()\n+  {\n+/*","path":"src/context.cpp","position":154,"original_position":154,"commit_id":"bbfa6e30457ff5ae1eba9bc3a667fa4f7321d457","original_commit_id":"bbfa6e30457ff5ae1eba9bc3a667fa4f7321d457","user":{"login":"xzyfer","id":579928,"avatar_url":"https://avatars.githubusercontent.com/u/579928?v=3","gravatar_id":"","url":"https://api.github.com/users/xzyfer","html_url":"https://github.com/xzyfer","followers_url":"https://api.github.com/users/xzyfer/followers","following_url":"https://api.github.com/users/xzyfer/following{/other_user}","gists_url":"https://api.github.com/users/xzyfer/gists{/gist_id}","starred_url":"https://api.github.com/users/xzyfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xzyfer/subscriptions","organizations_url":"https://api.github.com/users/xzyfer/orgs","repos_url":"https://api.github.com/users/xzyfer/repos","events_url":"https://api.github.com/users/xzyfer/events{/privacy}","received_events_url":"https://api.github.com/users/xzyfer/received_events","type":"User","site_admin":false},"body":"delete","created_at":"2016-12-11T06:01:49Z","updated_at":"2016-12-11T06:01:49Z","html_url":"https://github.com/sass/libsass/pull/2222#discussion_r91848600","pull_request_url":"https://api.github.com/repos/sass/libsass/pulls/2222","_links":{"self":{"href":"https://api.github.com/repos/sass/libsass/pulls/comments/91848600"},"html":{"href":"https://github.com/sass/libsass/pull/2222#discussion_r91848600"},"pull_request":{"href":"https://api.github.com/repos/sass/libsass/pulls/2222"}}},"pull_request":{"url":"https://api.github.com/repos/sass/libsass/pulls/2222","id":90908178,"html_url":"https://github.com/sass/libsass/pull/2222","diff_url":"https://github.com/sass/libsass/pull/2222.diff","patch_url":"https://github.com/sass/libsass/pull/2222.patch","issue_url":"https://api.github.com/repos/sass/libsass/issues/2222","number":2222,"state":"open","locked":false,"title":"Implement reference counted AST nodes","user":{"login":"mgreter","id":282293,"avatar_url":"https://avatars.githubusercontent.com/u/282293?v=3","gravatar_id":"","url":"https://api.github.com/users/mgreter","html_url":"https://github.com/mgreter","followers_url":"https://api.github.com/users/mgreter/followers","following_url":"https://api.github.com/users/mgreter/following{/other_user}","gists_url":"https://api.github.com/users/mgreter/gists{/gist_id}","starred_url":"https://api.github.com/users/mgreter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgreter/subscriptions","organizations_url":"https://api.github.com/users/mgreter/orgs","repos_url":"https://api.github.com/users/mgreter/repos","events_url":"https://api.github.com/users/mgreter/events{/privacy}","received_events_url":"https://api.github.com/users/mgreter/received_events","type":"User","site_admin":false},"body":"This is some work I've started maybe a year ago to change the current memory handling to a reference counted implementation (and rebased to current master). This is really just a POC and probably only covers about 10% of all the changes that would be needed. Nonetheless it already is a workable POC and might serve as a ground for anyone who would like to complete this task. At the moment libsass can take up an absurd amount of memory in certain situations (mostly with loops). And the only solution I see is to change the current memory handling to a more fine grained implementation. As there is no way to create closures or references in libsass, a reference counting implementation seems to fit perfectly (There should be no need for a multiple generation GC implementation).\n\nThe basic idea is to hold a stack object instead of the pointer to AST_Nodes directly.  The stack object is in charge to hold the pointer and to deallocate it once the reference count goes down to zero. This is a \"smart pointers\" implementation. We may could use shared_ptr from c++11, but I'm not sure how portable that would be (gcc 4.4?) and a custom implementation gives us more freedom to apply it to the existing code base and also has a better L1 cache locality, due to the reference counter beeing directly attached to every object.\n\nI might pick up on this work myself, but not sure when (next year or next decade) as I would estimate at least 160h of work until this is fully in a useable state for libsass (the rebasing alone took me 30h to get to a working state again). Posting here anyway, so the base work is not lost in the github nirvana.\n\nThe full glory with indivudial rebase commit can be seen at\nhttps://github.com/mgreter/libsass/commits/memory/ref-count-poc\nPOC: https://github.com/mgreter/libsass/blob/memory/ref-count-poc/src/context.cpp#L554-L584\nhttps://github.com/mgreter/libsass/blob/memory/ref-count-poc/src/ast_fwd_decl.hpp#L33-L56\n","created_at":"2016-10-25T23:00:58Z","updated_at":"2016-12-11T06:01:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c312e5bfe481e5702b3e5e0e03719a705c99c088","assignee":{"login":"mgreter","id":282293,"avatar_url":"https://avatars.githubusercontent.com/u/282293?v=3","gravatar_id":"","url":"https://api.github.com/users/mgreter","html_url":"https://github.com/mgreter","followers_url":"https://api.github.com/users/mgreter/followers","following_url":"https://api.github.com/users/mgreter/following{/other_user}","gists_url":"https://api.github.com/users/mgreter/gists{/gist_id}","starred_url":"https://api.github.com/users/mgreter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgreter/subscriptions","organizations_url":"https://api.github.com/users/mgreter/orgs","repos_url":"https://api.github.com/users/mgreter/repos","events_url":"https://api.github.com/users/mgreter/events{/privacy}","received_events_url":"https://api.github.com/users/mgreter/received_events","type":"User","site_admin":false},"assignees":[{"login":"mgreter","id":282293,"avatar_url":"https://avatars.githubusercontent.com/u/282293?v=3","gravatar_id":"","url":"https://api.github.com/users/mgreter","html_url":"https://github.com/mgreter","followers_url":"https://api.github.com/users/mgreter/followers","following_url":"https://api.github.com/users/mgreter/following{/other_user}","gists_url":"https://api.github.com/users/mgreter/gists{/gist_id}","starred_url":"https://api.github.com/users/mgreter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgreter/subscriptions","organizations_url":"https://api.github.com/users/mgreter/orgs","repos_url":"https://api.github.com/users/mgreter/repos","events_url":"https://api.github.com/users/mgreter/events{/privacy}","received_events_url":"https://api.github.com/users/mgreter/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/sass/libsass/pulls/2222/commits","review_comments_url":"https://api.github.com/repos/sass/libsass/pulls/2222/comments","review_comment_url":"https://api.github.com/repos/sass/libsass/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sass/libsass/issues/2222/comments","statuses_url":"https://api.github.com/repos/sass/libsass/statuses/bbfa6e30457ff5ae1eba9bc3a667fa4f7321d457","head":{"label":"mgreter:memory/ref-count","ref":"memory/ref-count","sha":"bbfa6e30457ff5ae1eba9bc3a667fa4f7321d457","user":{"login":"mgreter","id":282293,"avatar_url":"https://avatars.githubusercontent.com/u/282293?v=3","gravatar_id":"","url":"https://api.github.com/users/mgreter","html_url":"https://github.com/mgreter","followers_url":"https://api.github.com/users/mgreter/followers","following_url":"https://api.github.com/users/mgreter/following{/other_user}","gists_url":"https://api.github.com/users/mgreter/gists{/gist_id}","starred_url":"https://api.github.com/users/mgreter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgreter/subscriptions","organizations_url":"https://api.github.com/users/mgreter/orgs","repos_url":"https://api.github.com/users/mgreter/repos","events_url":"https://api.github.com/users/mgreter/events{/privacy}","received_events_url":"https://api.github.com/users/mgreter/received_events","type":"User","site_admin":false},"repo":{"id":13783687,"name":"libsass","full_name":"mgreter/libsass","owner":{"login":"mgreter","id":282293,"avatar_url":"https://avatars.githubusercontent.com/u/282293?v=3","gravatar_id":"","url":"https://api.github.com/users/mgreter","html_url":"https://github.com/mgreter","followers_url":"https://api.github.com/users/mgreter/followers","following_url":"https://api.github.com/users/mgreter/following{/other_user}","gists_url":"https://api.github.com/users/mgreter/gists{/gist_id}","starred_url":"https://api.github.com/users/mgreter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgreter/subscriptions","organizations_url":"https://api.github.com/users/mgreter/orgs","repos_url":"https://api.github.com/users/mgreter/repos","events_url":"https://api.github.com/users/mgreter/events{/privacy}","received_events_url":"https://api.github.com/users/mgreter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mgreter/libsass","description":"A C implementation of a Sass compiler","fork":true,"url":"https://api.github.com/repos/mgreter/libsass","forks_url":"https://api.github.com/repos/mgreter/libsass/forks","keys_url":"https://api.github.com/repos/mgreter/libsass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mgreter/libsass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mgreter/libsass/teams","hooks_url":"https://api.github.com/repos/mgreter/libsass/hooks","issue_events_url":"https://api.github.com/repos/mgreter/libsass/issues/events{/number}","events_url":"https://api.github.com/repos/mgreter/libsass/events","assignees_url":"https://api.github.com/repos/mgreter/libsass/assignees{/user}","branches_url":"https://api.github.com/repos/mgreter/libsass/branches{/branch}","tags_url":"https://api.github.com/repos/mgreter/libsass/tags","blobs_url":"https://api.github.com/repos/mgreter/libsass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mgreter/libsass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mgreter/libsass/git/refs{/sha}","trees_url":"https://api.github.com/repos/mgreter/libsass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mgreter/libsass/statuses/{sha}","languages_url":"https://api.github.com/repos/mgreter/libsass/languages","stargazers_url":"https://api.github.com/repos/mgreter/libsass/stargazers","contributors_url":"https://api.github.com/repos/mgreter/libsass/contributors","subscribers_url":"https://api.github.com/repos/mgreter/libsass/subscribers","subscription_url":"https://api.github.com/repos/mgreter/libsass/subscription","commits_url":"https://api.github.com/repos/mgreter/libsass/commits{/sha}","git_commits_url":"https://api.github.com/repos/mgreter/libsass/git/commits{/sha}","comments_url":"https://api.github.com/repos/mgreter/libsass/comments{/number}","issue_comment_url":"https://api.github.com/repos/mgreter/libsass/issues/comments{/number}","contents_url":"https://api.github.com/repos/mgreter/libsass/contents/{+path}","compare_url":"https://api.github.com/repos/mgreter/libsass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mgreter/libsass/merges","archive_url":"https://api.github.com/repos/mgreter/libsass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mgreter/libsass/downloads","issues_url":"https://api.github.com/repos/mgreter/libsass/issues{/number}","pulls_url":"https://api.github.com/repos/mgreter/libsass/pulls{/number}","milestones_url":"https://api.github.com/repos/mgreter/libsass/milestones{/number}","notifications_url":"https://api.github.com/repos/mgreter/libsass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mgreter/libsass/labels{/name}","releases_url":"https://api.github.com/repos/mgreter/libsass/releases{/id}","deployments_url":"https://api.github.com/repos/mgreter/libsass/deployments","created_at":"2013-10-22T19:33:21Z","updated_at":"2015-04-06T17:27:23Z","pushed_at":"2016-12-10T21:31:31Z","git_url":"git://github.com/mgreter/libsass.git","ssh_url":"git@github.com:mgreter/libsass.git","clone_url":"https://github.com/mgreter/libsass.git","svn_url":"https://github.com/mgreter/libsass","homepage":"","size":10571,"stargazers_count":2,"watchers_count":2,"language":"C++","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":2,"default_branch":"master"}},"base":{"label":"sass:master","ref":"master","sha":"0ff2474407a9a1ff98196135a52f54b58ce9542f","user":{"login":"sass","id":317889,"avatar_url":"https://avatars.githubusercontent.com/u/317889?v=3","gravatar_id":"","url":"https://api.github.com/users/sass","html_url":"https://github.com/sass","followers_url":"https://api.github.com/users/sass/followers","following_url":"https://api.github.com/users/sass/following{/other_user}","gists_url":"https://api.github.com/users/sass/gists{/gist_id}","starred_url":"https://api.github.com/users/sass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sass/subscriptions","organizations_url":"https://api.github.com/users/sass/orgs","repos_url":"https://api.github.com/users/sass/repos","events_url":"https://api.github.com/users/sass/events{/privacy}","received_events_url":"https://api.github.com/users/sass/received_events","type":"Organization","site_admin":false},"repo":{"id":3319769,"name":"libsass","full_name":"sass/libsass","owner":{"login":"sass","id":317889,"avatar_url":"https://avatars.githubusercontent.com/u/317889?v=3","gravatar_id":"","url":"https://api.github.com/users/sass","html_url":"https://github.com/sass","followers_url":"https://api.github.com/users/sass/followers","following_url":"https://api.github.com/users/sass/following{/other_user}","gists_url":"https://api.github.com/users/sass/gists{/gist_id}","starred_url":"https://api.github.com/users/sass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sass/subscriptions","organizations_url":"https://api.github.com/users/sass/orgs","repos_url":"https://api.github.com/users/sass/repos","events_url":"https://api.github.com/users/sass/events{/privacy}","received_events_url":"https://api.github.com/users/sass/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sass/libsass","description":"A C/C++ implementation of a Sass compiler","fork":false,"url":"https://api.github.com/repos/sass/libsass","forks_url":"https://api.github.com/repos/sass/libsass/forks","keys_url":"https://api.github.com/repos/sass/libsass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sass/libsass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sass/libsass/teams","hooks_url":"https://api.github.com/repos/sass/libsass/hooks","issue_events_url":"https://api.github.com/repos/sass/libsass/issues/events{/number}","events_url":"https://api.github.com/repos/sass/libsass/events","assignees_url":"https://api.github.com/repos/sass/libsass/assignees{/user}","branches_url":"https://api.github.com/repos/sass/libsass/branches{/branch}","tags_url":"https://api.github.com/repos/sass/libsass/tags","blobs_url":"https://api.github.com/repos/sass/libsass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sass/libsass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sass/libsass/git/refs{/sha}","trees_url":"https://api.github.com/repos/sass/libsass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sass/libsass/statuses/{sha}","languages_url":"https://api.github.com/repos/sass/libsass/languages","stargazers_url":"https://api.github.com/repos/sass/libsass/stargazers","contributors_url":"https://api.github.com/repos/sass/libsass/contributors","subscribers_url":"https://api.github.com/repos/sass/libsass/subscribers","subscription_url":"https://api.github.com/repos/sass/libsass/subscription","commits_url":"https://api.github.com/repos/sass/libsass/commits{/sha}","git_commits_url":"https://api.github.com/repos/sass/libsass/git/commits{/sha}","comments_url":"https://api.github.com/repos/sass/libsass/comments{/number}","issue_comment_url":"https://api.github.com/repos/sass/libsass/issues/comments{/number}","contents_url":"https://api.github.com/repos/sass/libsass/contents/{+path}","compare_url":"https://api.github.com/repos/sass/libsass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sass/libsass/merges","archive_url":"https://api.github.com/repos/sass/libsass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sass/libsass/downloads","issues_url":"https://api.github.com/repos/sass/libsass/issues{/number}","pulls_url":"https://api.github.com/repos/sass/libsass/pulls{/number}","milestones_url":"https://api.github.com/repos/sass/libsass/milestones{/number}","notifications_url":"https://api.github.com/repos/sass/libsass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sass/libsass/labels{/name}","releases_url":"https://api.github.com/repos/sass/libsass/releases{/id}","deployments_url":"https://api.github.com/repos/sass/libsass/deployments","created_at":"2012-01-31T22:59:07Z","updated_at":"2016-12-10T19:12:29Z","pushed_at":"2016-12-10T16:44:31Z","git_url":"git://github.com/sass/libsass.git","ssh_url":"git@github.com:sass/libsass.git","clone_url":"https://github.com/sass/libsass.git","svn_url":"https://github.com/sass/libsass","homepage":"http://libsass.org","size":17362,"stargazers_count":3349,"watchers_count":3349,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":359,"mirror_url":null,"open_issues_count":62,"forks":359,"open_issues":62,"watchers":3349,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sass/libsass/pulls/2222"},"html":{"href":"https://github.com/sass/libsass/pull/2222"},"issue":{"href":"https://api.github.com/repos/sass/libsass/issues/2222"},"comments":{"href":"https://api.github.com/repos/sass/libsass/issues/2222/comments"},"review_comments":{"href":"https://api.github.com/repos/sass/libsass/pulls/2222/comments"},"review_comment":{"href":"https://api.github.com/repos/sass/libsass/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sass/libsass/pulls/2222/commits"},"statuses":{"href":"https://api.github.com/repos/sass/libsass/statuses/bbfa6e30457ff5ae1eba9bc3a667fa4f7321d457"}}}}
{"actor":{"display_login":"xzyfer"}}