{"action":"created","issue":{"url":"https://api.github.com/repos/darktable-org/darktable/issues/946","labels_url":"https://api.github.com/repos/darktable-org/darktable/issues/946/labels{/name}","comments_url":"https://api.github.com/repos/darktable-org/darktable/issues/946/comments","events_url":"https://api.github.com/repos/darktable-org/darktable/issues/946/events","html_url":"https://github.com/darktable-org/darktable/pull/946","id":94029387,"number":946,"title":"Lots of various fixes for jobs-related memory leaks","user":{"login":"LebedevRI","id":88600,"avatar_url":"https://avatars.githubusercontent.com/u/88600?v=3","gravatar_id":"","url":"https://api.github.com/users/LebedevRI","html_url":"https://github.com/LebedevRI","followers_url":"https://api.github.com/users/LebedevRI/followers","following_url":"https://api.github.com/users/LebedevRI/following{/other_user}","gists_url":"https://api.github.com/users/LebedevRI/gists{/gist_id}","starred_url":"https://api.github.com/users/LebedevRI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LebedevRI/subscriptions","organizations_url":"https://api.github.com/users/LebedevRI/orgs","repos_url":"https://api.github.com/users/LebedevRI/repos","events_url":"https://api.github.com/users/LebedevRI/events{/privacy}","received_events_url":"https://api.github.com/users/LebedevRI/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-09T12:03:44Z","updated_at":"2015-07-14T11:25:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/darktable-org/darktable/pulls/946","html_url":"https://github.com/darktable-org/darktable/pull/946","diff_url":"https://github.com/darktable-org/darktable/pull/946.diff","patch_url":"https://github.com/darktable-org/darktable/pull/946.patch"},"body":"Reasons:\r\n* When we discard job, we would leak ALL memory related to the jobs, even params, because currently\r\njob is supposed to free params by itself.\r\n* When we run job, but it exits half-way, because of inadvertence we could also leak some things.\r\n\r\nSolution:\r\nPut *dt_control_job_dispose()* in charge of freeing memory. Since it *should* be called at the end of every job life, that is the best place for it.\r\n\r\nRecipe:\r\n* Make *dt_control_job_set_params()* also receive and store function pointer that will be called to free job's memory.\r\n* Make sure that job does not free it's params.\r\n* If params for this job contains pointers to newly-allocated memory (or it will be allocated in other jobs, see *dt_control_image_enumerator_alloc()*), refactor all this allocation into a function.\r\n* If params for this job contains pointers to newly-allocated memory, or something else that needs to be cleaned (see *dt_control_image_enumerator_cleanup()*), refactor all this into a function, and pass it into *dt_control_job_set_params()*."},"comment":{"url":"https://api.github.com/repos/darktable-org/darktable/issues/comments/121206790","html_url":"https://github.com/darktable-org/darktable/pull/946#issuecomment-121206790","issue_url":"https://api.github.com/repos/darktable-org/darktable/issues/946","id":121206790,"user":{"login":"LebedevRI","id":88600,"avatar_url":"https://avatars.githubusercontent.com/u/88600?v=3","gravatar_id":"","url":"https://api.github.com/users/LebedevRI","html_url":"https://github.com/LebedevRI","followers_url":"https://api.github.com/users/LebedevRI/followers","following_url":"https://api.github.com/users/LebedevRI/following{/other_user}","gists_url":"https://api.github.com/users/LebedevRI/gists{/gist_id}","starred_url":"https://api.github.com/users/LebedevRI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LebedevRI/subscriptions","organizations_url":"https://api.github.com/users/LebedevRI/orgs","repos_url":"https://api.github.com/users/LebedevRI/repos","events_url":"https://api.github.com/users/LebedevRI/events{/privacy}","received_events_url":"https://api.github.com/users/LebedevRI/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T11:25:16Z","updated_at":"2015-07-14T11:25:16Z","body":"```\r\n[13:41:58] <LebedevRI> hey. so about that jobs fixes, any changes?\r\n[13:46:57] <houz> looks good now\r\n[13:50:02] <LebedevRI> can it be merged?\r\n[14:05:48] <houz> i'd say yes\r\n```"}}