{"action":"created","issue":{"url":"https://api.github.com/repos/google/sanitizers/issues/703","repository_url":"https://api.github.com/repos/google/sanitizers","labels_url":"https://api.github.com/repos/google/sanitizers/issues/703/labels{/name}","comments_url":"https://api.github.com/repos/google/sanitizers/issues/703/comments","events_url":"https://api.github.com/repos/google/sanitizers/issues/703/events","html_url":"https://github.com/google/sanitizers/issues/703","id":168915285,"number":703,"title":"LSan is almost unusable on AArch64.","user":{"login":"chefmax","id":3305556,"avatar_url":"https://avatars.githubusercontent.com/u/3305556?v=3","gravatar_id":"","url":"https://api.github.com/users/chefmax","html_url":"https://github.com/chefmax","followers_url":"https://api.github.com/users/chefmax/followers","following_url":"https://api.github.com/users/chefmax/following{/other_user}","gists_url":"https://api.github.com/users/chefmax/gists{/gist_id}","starred_url":"https://api.github.com/users/chefmax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chefmax/subscriptions","organizations_url":"https://api.github.com/users/chefmax/orgs","repos_url":"https://api.github.com/users/chefmax/repos","events_url":"https://api.github.com/users/chefmax/events{/privacy}","received_events_url":"https://api.github.com/users/chefmax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-08-02T15:28:33Z","updated_at":"2016-08-02T17:32:45Z","closed_at":null,"body":"LSan works very slow even on trivial hello-world leaks. This happens because Aarch64 uses **SizeClassAllocator32**, in particular, here the code of **ForEachChunk** method of **SizeClassAllocator32**, that LSan calls several times:\r\n```\r\n  // Iterate over all existing chunks.\r\n  // The allocator must be locked when calling this function.\r\n  void ForEachChunk(ForEachChunkCallback callback, void *arg) {\r\n    for (uptr region = 0; region < kNumPossibleRegions; region++)\r\n      if (possible_regions[region]) {\r\n        uptr chunk_size = SizeClassMap::Size(possible_regions[region]);\r\n        uptr max_chunks_in_region = kRegionSize / (chunk_size + kMetadataSize);\r\n        uptr region_beg = region * kRegionSize;\r\n        for (uptr chunk = region_beg;\r\n             chunk < region_beg + max_chunks_in_region * chunk_size;\r\n             chunk += chunk_size) {\r\n          // Too slow: CHECK_EQ((void *)chunk, GetBlockBegin((void *)chunk));\r\n          callback(chunk, arg);\r\n        }\r\n      }\r\n  }\r\n```\r\nFor 39-bit VMA **kNumPossibleRegions** is calculated as:\r\n```\r\nSANITIZER_MMAP_RANGE_SIZE / kRegionSize\r\n```\r\nthat equals to ``2^47 / 2^20 == 2^27``, thus we have a very busy loop in **SizeClassAllocator32**.\r\n\r\nThe problem I faced when trying to fix this is that actual VMA size (39, 42 or 48) is calculated dynamically at runtime, while allocator needs **kSpaceSize** to be determined statically. I wonder whether we could fix this in some way? Ideally, it would be nice to use **SizeClassAllocator64**, but it seems to be impossible according to https://github.com/google/sanitizers/issues/246. Any ideas?"},"comment":{"url":"https://api.github.com/repos/google/sanitizers/issues/comments/236979984","html_url":"https://github.com/google/sanitizers/issues/703#issuecomment-236979984","issue_url":"https://api.github.com/repos/google/sanitizers/issues/703","id":236979984,"user":{"login":"chefmax","id":3305556,"avatar_url":"https://avatars.githubusercontent.com/u/3305556?v=3","gravatar_id":"","url":"https://api.github.com/users/chefmax","html_url":"https://github.com/chefmax","followers_url":"https://api.github.com/users/chefmax/followers","following_url":"https://api.github.com/users/chefmax/following{/other_user}","gists_url":"https://api.github.com/users/chefmax/gists{/gist_id}","starred_url":"https://api.github.com/users/chefmax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chefmax/subscriptions","organizations_url":"https://api.github.com/users/chefmax/orgs","repos_url":"https://api.github.com/users/chefmax/repos","events_url":"https://api.github.com/users/chefmax/events{/privacy}","received_events_url":"https://api.github.com/users/chefmax/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T17:32:45Z","updated_at":"2016-08-02T17:32:45Z","body":"Perhaps we could pick primary allocator dynamically? Say, in InitializeAllocator routine. This would imply some space overhead though."}}
{"actor":{"display_login":"chefmax"}}