App Verifier Stop 0202: Freeing heap block containing an active critical section during GdiPlusShutdown

StackOverflow https://stackoverflow.com/questions/11145714

  •  16-06-2021
  •  | 
  •  

سؤال

When running the Microsoft Application Verifier i would get an error 0202 on shutdown:

VERIFIER STOP 00000202:
   pid 0x1160: Freeing heap block containing an active critical section. 
   11456F48 : Critical section address.
   047D05B4 : Critical section initialization stack trace.
   11456F40 : Heap block...(cut off)

The error would happen while calling GdiplusShutdown.

From the Application Verifier documentation:

Freeing heap block containing an active critical section

Application Verifier break message

Freeing heap block containing an active critical section. Memory location at of size contains an active lock.

Probable cause

This break is generated if a heap allocation contains a critical section, the allocation is freed and the critical section has not been deleted.

Information displayed by Application Verifier

  • Parameter1 - Critical section address
  • Parameter2 - Critical section initialization stack trace
  • Parameter3 - Heap block address
  • Parameter4 - Heap block size
  • Description - Freeing heap block containing an active critical section

Additional information

Verifier stop code 0202.

Check the contents of the current call stack. The culprit is usually the caller of HeapFree or HeapDestroy on the current stack trace.

Frequency of this error is high.

To debug this stop use the following debugger commands:

  • !cs –s parameter1 - dump information about this critical section.
  • ln parameter1 – to show symbols near the address of the critical section. This should help identify the leaked critical section.
  • dds parameter2 – to dump the stack trace for this critical section initialization.

parameter3 and parameter4 might help understand where was this heap block allocated (the size of the allocation is probably significant).

هل كانت مفيدة؟

المحلول

i had this error a few months ago and i'd forgotten the solution.

Be sure to free any GDI+ Images (e.g. GdipDisposeImage) before trying to shutdown GDI+.

Otherwise you leak a Critical Section, and who knows what else. And certainly don't try to dispose an image after GDI+ has already been shutdown.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top