{"action":"created","issue":{"url":"https://api.github.com/repos/leo-project/leofs/issues/440","labels_url":"https://api.github.com/repos/leo-project/leofs/issues/440/labels{/name}","comments_url":"https://api.github.com/repos/leo-project/leofs/issues/440/comments","events_url":"https://api.github.com/repos/leo-project/leofs/issues/440/events","html_url":"https://github.com/leo-project/leofs/issues/440","id":123598952,"number":440,"title":"[leo_erasure] double free & memory leak and fragmentation","user":{"login":"mocchira","id":279052,"avatar_url":"https://avatars.githubusercontent.com/u/279052?v=3","gravatar_id":"","url":"https://api.github.com/users/mocchira","html_url":"https://github.com/mocchira","followers_url":"https://api.github.com/users/mocchira/followers","following_url":"https://api.github.com/users/mocchira/following{/other_user}","gists_url":"https://api.github.com/users/mocchira/gists{/gist_id}","starred_url":"https://api.github.com/users/mocchira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mocchira/subscriptions","organizations_url":"https://api.github.com/users/mocchira/orgs","repos_url":"https://api.github.com/users/mocchira/repos","events_url":"https://api.github.com/users/mocchira/events{/privacy}","received_events_url":"https://api.github.com/users/mocchira/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/leo-project/leofs/labels/Bug","name":"Bug","color":"fc2929"},{"url":"https://api.github.com/repos/leo-project/leofs/labels/Priority-HIGH","name":"Priority-HIGH","color":"f7c6c7"}],"state":"open","locked":false,"assignee":{"login":"mocchira","id":279052,"avatar_url":"https://avatars.githubusercontent.com/u/279052?v=3","gravatar_id":"","url":"https://api.github.com/users/mocchira","html_url":"https://github.com/mocchira","followers_url":"https://api.github.com/users/mocchira/followers","following_url":"https://api.github.com/users/mocchira/following{/other_user}","gists_url":"https://api.github.com/users/mocchira/gists{/gist_id}","starred_url":"https://api.github.com/users/mocchira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mocchira/subscriptions","organizations_url":"https://api.github.com/users/mocchira/orgs","repos_url":"https://api.github.com/users/mocchira/repos","events_url":"https://api.github.com/users/mocchira/events{/privacy}","received_events_url":"https://api.github.com/users/mocchira/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/leo-project/leofs/milestones/26","html_url":"https://github.com/leo-project/leofs/milestones/1.4.0","labels_url":"https://api.github.com/repos/leo-project/leofs/milestones/26/labels","id":816166,"number":26,"title":"1.4.0","description":"* LeoFS v1.4\r\n    * NFS Support (Beta-2)\r\n    * Improve performance of the list objects\r\n    * Improve Web GUI Console (Option)\r\n    * Improve compatibility S3-APIs#6\r\n        * Objects Expiration into the bucket\r\n        * Versioning","creator":{"login":"mocchira","id":279052,"avatar_url":"https://avatars.githubusercontent.com/u/279052?v=3","gravatar_id":"","url":"https://api.github.com/users/mocchira","html_url":"https://github.com/mocchira","followers_url":"https://api.github.com/users/mocchira/followers","following_url":"https://api.github.com/users/mocchira/following{/other_user}","gists_url":"https://api.github.com/users/mocchira/gists{/gist_id}","starred_url":"https://api.github.com/users/mocchira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mocchira/subscriptions","organizations_url":"https://api.github.com/users/mocchira/orgs","repos_url":"https://api.github.com/users/mocchira/repos","events_url":"https://api.github.com/users/mocchira/events{/privacy}","received_events_url":"https://api.github.com/users/mocchira/received_events","type":"User","site_admin":false},"open_issues":33,"closed_issues":7,"state":"open","created_at":"2014-10-07T05:17:19Z","updated_at":"2015-12-23T04:03:32Z","due_on":"2016-02-17T15:00:00Z","closed_at":null},"comments":1,"created_at":"2015-12-23T04:03:32Z","updated_at":"2015-12-24T01:54:40Z","closed_at":null,"body":"## Problem\r\n- double free\r\n  - https://github.com/leo-project/leo_erasure/blob/develop/c_src/jerasure_mod.cpp#L148-L149\r\n  - https://github.com/leo-project/leo_erasure/blob/develop/c_src/jerasure_mod.cpp#L263-L264\r\n\r\n- `real_decoding_matrix` will leak at the below blocks\r\n  - https://github.com/leo-project/leo_erasure/blob/develop/c_src/jerasure_mod.cpp#L517\r\n  - https://github.com/leo-project/leo_erasure/blob/develop/c_src/jerasure_mod.cpp#L536\r\n  - https://github.com/leo-project/leo_erasure/blob/develop/c_src/jerasure_mod.cpp#L640\r\n  - https://github.com/leo-project/leo_erasure/blob/develop/c_src/jerasure_mod.cpp#L659\r\n\r\n- fragmentation\r\n  - Since there are lots of malloc/free calls over multiple threads under heavy load, Heap can be fragmented and that may result in failing malloc ( return NULL ) and may crash due to the above issues.\r\n\r\n## Solution\r\ndead simple.\r\nAllocating on stack will solve all problems."},"comment":{"url":"https://api.github.com/repos/leo-project/leofs/issues/comments/167022537","html_url":"https://github.com/leo-project/leofs/issues/440#issuecomment-167022537","issue_url":"https://api.github.com/repos/leo-project/leofs/issues/440","id":167022537,"user":{"login":"mocchira","id":279052,"avatar_url":"https://avatars.githubusercontent.com/u/279052?v=3","gravatar_id":"","url":"https://api.github.com/users/mocchira","html_url":"https://github.com/mocchira","followers_url":"https://api.github.com/users/mocchira/followers","following_url":"https://api.github.com/users/mocchira/following{/other_user}","gists_url":"https://api.github.com/users/mocchira/gists{/gist_id}","starred_url":"https://api.github.com/users/mocchira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mocchira/subscriptions","organizations_url":"https://api.github.com/users/mocchira/orgs","repos_url":"https://api.github.com/users/mocchira/repos","events_url":"https://api.github.com/users/mocchira/events{/privacy}","received_events_url":"https://api.github.com/users/mocchira/received_events","type":"User","site_admin":false},"created_at":"2015-12-24T01:54:40Z","updated_at":"2015-12-24T01:54:40Z","body":"and also scan-build found out the below problem.\r\nhttp://ec2-54-168-172-221.ap-northeast-1.compute.amazonaws.com/leo_erasure/analysis/2015-12-24-013355-13186-1/report-afb5e5.html#EndPath"}}