[PATCH] Fix memory leak in lib/Support/DynamicLibrary.cpp wrap OpenedHandles in llvm::ManagedStatic<>

Chandler Carruth chandlerc at gmail.com
Tue Apr 14 07:56:20 PDT 2015


Please see the comments David sent to the mailing list about this patch. I've quoted them below:

> This is one of those "what is a leak" existential questions.

> 

> There are two common attitudes/interpretations:

> 

> 1. Memory that is unreachable

> 2. Memory that is never deallocated

> 

> Most tools have been taught to only report (1) and ignore (2).

> 

> This idiom (allocating and never deallocating globals) is sometimes used to avoid global destructors which can be dangerously racy (if a multithreaded program is shutting down (possibly due to exceptions, etc) and hasn't stopped all its worker threads, it could be problematic to try to destroy globals that may still be in use by other threads - leading to failure-on-failure modes that can make debugging the original failure more difficult)



http://reviews.llvm.org/D8838

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list