1

I know memory leaks from allocations through malloc or new are cleaned up when a process exits as are file handles. But the question is are things like the HBITMAP / HICON handles loaded with LoadImage closed as well (not using LR_SHARED).

Reason I ask is because when I run deleaker on a MFC app using BCGControlBarPro it always find several leaks of Atom's, Event Handles and a HICON/HCURSOR type. Most from MFC and some from BCDControlBarPro. For example the HCURSOR leak is from load image in CBCGPGlobalUtils::GetStretchCursor(). They are initialized one time so it looks like they presume that it does close them, I just want to be sure because I thought resources were different?

TIA!!

user3161924
  • 1,849
  • 18
  • 33
  • 2
    yes, all gdi resourses also will be destroyed when process exit – RbMm Aug 19 '21 at 21:52
  • 1
    All memory/resources that are created and stored *within the process* are reclaimed by the OS when the process exits. However, a process can also create memory/resources *globally* as well, and those are not reclaimed until the OS is rebooted, so watch out for that. – Remy Lebeau Aug 19 '21 at 22:44
  • 2
    Expanding on @RemyLebeau's remarks: Specifically, some ATOMs are global, and those will not be cleaned up at process exit. – Raymond Chen Aug 20 '21 at 00:26
  • This may be false-positive reports: if the library holds those resource in some static variables, they could get released after deleaker generates its report. – Vlad Feinstein Aug 20 '21 at 03:51
  • Also keep in mind that [atom tables](https://learn.microsoft.com/en-us/windows/win32/dataxchg/about-atom-tables) are insanely limited in size. Leaking global atoms can quickly cause every other application to fail. – IInspectable Aug 20 '21 at 08:59

0 Answers0