What is the difference between a direct and indirect leak?

后端 未结 1 701
旧时难觅i
旧时难觅i 2021-02-19 00:45

I got the following output from the LeakSanitizer tool. What is the difference between a direct and indirect leak, as the tool understands it?

13: ==29107==ERROR         


        
1条回答
  •  再見小時候
    2021-02-19 01:33

    The LSan wiki design document states:

    Another useful feature is being able to distinguish between directly leaked blocks (not reachable from anywhere) and indirectly leaked blocks (reachable from other leaked blocks).

    Stated another way, indirect leaks are a result of direct leaks. Fixing direct leaks should make the indirect leaks become either fixed or direct leaks themselves (depending on whether their memory management is implemented correctly or not, respectively).

    0 讨论(0)
提交回复
热议问题