{"action":"created","issue":{"url":"https://api.github.com/repos/RoaringBitmap/CRoaring/issues/39","repository_url":"https://api.github.com/repos/RoaringBitmap/CRoaring","labels_url":"https://api.github.com/repos/RoaringBitmap/CRoaring/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/RoaringBitmap/CRoaring/issues/39/comments","events_url":"https://api.github.com/repos/RoaringBitmap/CRoaring/issues/39/events","html_url":"https://github.com/RoaringBitmap/CRoaring/issues/39","id":159277867,"number":39,"title":"Memory allocation/deallocation in caller/callee","user":{"login":"Ezibenroc","id":8900834,"avatar_url":"https://avatars.githubusercontent.com/u/8900834?v=3","gravatar_id":"","url":"https://api.github.com/users/Ezibenroc","html_url":"https://github.com/Ezibenroc","followers_url":"https://api.github.com/users/Ezibenroc/followers","following_url":"https://api.github.com/users/Ezibenroc/following{/other_user}","gists_url":"https://api.github.com/users/Ezibenroc/gists{/gist_id}","starred_url":"https://api.github.com/users/Ezibenroc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ezibenroc/subscriptions","organizations_url":"https://api.github.com/users/Ezibenroc/orgs","repos_url":"https://api.github.com/users/Ezibenroc/repos","events_url":"https://api.github.com/users/Ezibenroc/events{/privacy}","received_events_url":"https://api.github.com/users/Ezibenroc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-08T21:32:19Z","updated_at":"2016-06-09T19:52:09Z","closed_at":"2016-06-09T14:48:39Z","body":"There is this function in `roaring.h`:\r\n\r\n```c\r\n/**\r\n * Convert the bitmap to an array. Array is allocated and caller is responsible\r\n * for eventually freeing it.\r\n */\r\nuint32_t *roaring_bitmap_to_uint32_array(const roaring_bitmap_t *ra,\r\n                                         uint32_t *cardinality);\r\n```\r\nCurrently, the callee allocates the memory, therefore, it should be responsible of freeing it. So I think the library should provide the corresponding function:\r\n```c\r\nvoid free_array(uint32_t *array);\r\n```\r\nAlternatively, the caller could be responsible of allocating the array (but it would require a call to `roaring_bitmap_get_cardinality` before):\r\n```c\r\nvoid roaring_bitmap_to_uint32_array(const roaring_bitmap_t *ra, uint32_t * array);\r\n```\r\n\r\nThe issue is the same for `roaring_bitmap_serialize`."},"comment":{"url":"https://api.github.com/repos/RoaringBitmap/CRoaring/issues/comments/225006801","html_url":"https://github.com/RoaringBitmap/CRoaring/issues/39#issuecomment-225006801","issue_url":"https://api.github.com/repos/RoaringBitmap/CRoaring/issues/39","id":225006801,"user":{"login":"Ezibenroc","id":8900834,"avatar_url":"https://avatars.githubusercontent.com/u/8900834?v=3","gravatar_id":"","url":"https://api.github.com/users/Ezibenroc","html_url":"https://github.com/Ezibenroc","followers_url":"https://api.github.com/users/Ezibenroc/followers","following_url":"https://api.github.com/users/Ezibenroc/following{/other_user}","gists_url":"https://api.github.com/users/Ezibenroc/gists{/gist_id}","starred_url":"https://api.github.com/users/Ezibenroc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ezibenroc/subscriptions","organizations_url":"https://api.github.com/users/Ezibenroc/orgs","repos_url":"https://api.github.com/users/Ezibenroc/repos","events_url":"https://api.github.com/users/Ezibenroc/events{/privacy}","received_events_url":"https://api.github.com/users/Ezibenroc/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T19:52:09Z","updated_at":"2016-06-09T19:52:09Z","body":"There is apparently a bug, but I cannot find its cause.\r\n\r\nWhen I run the test `toplevel_unit`, it does not terminate. However, there is no significant CPU load, so it is not an infinite loop.\r\nThis still happens if I remove all the sub-tests except  `test_portable_serialize` and `test_serialize`. But if I remove one of these two tests, then the process terminates normally.\r\nI can also remove a great part of these two tests and still have this bug (I can paste here the minimal example, if needed).\r\n\r\nI did not test this yet on an other machine.\r\n\r\nValgrind says there are invalid writes in `bitset_extract_setbits_avx2` (used by `roaring_bitmap_to_uint32_array`), maybe it is related."}}
{"actor":{"display_login":"Ezibenroc"}}