{"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/1595","labels_url":"https://api.github.com/repos/micropython/micropython/issues/1595/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/1595/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/1595/events","html_url":"https://github.com/micropython/micropython/pull/1595","id":115604397,"number":1595,"title":"py: Clear finalizer flag when calling gc_free.","user":{"login":"dhylands","id":127500,"avatar_url":"https://avatars.githubusercontent.com/u/127500?v=3","gravatar_id":"","url":"https://api.github.com/users/dhylands","html_url":"https://github.com/dhylands","followers_url":"https://api.github.com/users/dhylands/followers","following_url":"https://api.github.com/users/dhylands/following{/other_user}","gists_url":"https://api.github.com/users/dhylands/gists{/gist_id}","starred_url":"https://api.github.com/users/dhylands/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhylands/subscriptions","organizations_url":"https://api.github.com/users/dhylands/orgs","repos_url":"https://api.github.com/users/dhylands/repos","events_url":"https://api.github.com/users/dhylands/events{/privacy}","received_events_url":"https://api.github.com/users/dhylands/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-06T22:35:28Z","updated_at":"2015-11-06T23:30:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/micropython/micropython/pulls/1595","html_url":"https://github.com/micropython/micropython/pull/1595","diff_url":"https://github.com/micropython/micropython/pull/1595.diff","patch_url":"https://github.com/micropython/micropython/pull/1595.patch"},"body":"Currently, the only place that clears the bit is in gc_collect.\r\nSo if a block with a finalizer is allocated, and subsequently\r\nfreed, and then the block is reallocated with no finalizer then\r\nthe bit remains set.\r\n\r\nThis could also be fixed by having gc_alloc clear the bit, but\r\nI'm pretty sure that free is called way less than alloc, so doing\r\nit in free is more efficient."},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/154576316","html_url":"https://github.com/micropython/micropython/pull/1595#issuecomment-154576316","issue_url":"https://api.github.com/repos/micropython/micropython/issues/1595","id":154576316,"user":{"login":"dpgeorge","id":6187689,"avatar_url":"https://avatars.githubusercontent.com/u/6187689?v=3","gravatar_id":"","url":"https://api.github.com/users/dpgeorge","html_url":"https://github.com/dpgeorge","followers_url":"https://api.github.com/users/dpgeorge/followers","following_url":"https://api.github.com/users/dpgeorge/following{/other_user}","gists_url":"https://api.github.com/users/dpgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/dpgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpgeorge/subscriptions","organizations_url":"https://api.github.com/users/dpgeorge/orgs","repos_url":"https://api.github.com/users/dpgeorge/repos","events_url":"https://api.github.com/users/dpgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/dpgeorge/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T23:30:24Z","updated_at":"2015-11-06T23:30:24Z","body":"Ok, you have definitely found the cause of the bug.  You are right we need to decide on whether gc_free calls a finaliser (I think it should, but it could be that it doesn't and it's up to the caller to know that it must explicitly call the finaliser, since it's anyway explicitly calling free)."}}