Heap Memory problems. debugging Plugins


This problem may related to http://www.juce.com/forum/topic/heap-corruption-demo-plugin-host-after-loading-demo-plugi

Im now using VS2012. And when debugging any of my plugins through the Juce Demo Plugin Host, after unloading the DLL, the dbg-runtime detects Heap Memory Corruptions. This did not happen in older times, when using VS2008 and a older release of Juce. 


Very hard to judge what could be causing that - using a different compiler will mean entirely different memory layout, and probably a different runtime, so it's hard to say it's something new. Could just have been that you didn't notice before. Haven't seen it myself, but I'll keep an eye out for it.


mostly  i get this: (TeEQ.dllI is my plugin)

HEAP[Plugin Host.exe]: HEAP: Free Heap block 00B53980 modified at 00B539A8 after it was freed

Plugin Host.exe has triggered a breakpoint

     ntdll.dll!_RtlpBreakPointHeap@4()    Unknown
     ntdll.dll!_RtlpCoalesceFreeBlocks@16()    Unknown
     ntdll.dll!@RtlpFreeHeap@16()    Unknown
     ntdll.dll!_RtlFreeHeap@12()    Unknown
     ntdll.dll!_RtlDebugFreeHeap@12()    Unknown
     ntdll.dll!@RtlpFreeHeap@16()    Unknown
     ntdll.dll!_RtlFreeHeap@12()    Unknown
>    TeEQ.dll!_free_base(void * pBlock=0x00b53590) Line 50    C
     TeEQ.dll!_free_dbg_nolock(void * pUserData=0x00b535b0, int nBlockUse=2) Line 1431    C++
     TeEQ.dll!_free_dbg(void * pUserData=0x00b535b0, int nBlockUse=2) Line 1265    C++
     TeEQ.dll!_freefls(void * data=0x00b535b0) Line 433    C
     ntdll.dll!_RtlFlsFree@4()    Unknown
     KernelBase.dll!_FlsFree@4()    Unknown
     TeEQ.dll!__crtFlsFree(unsigned long dwFlsIndex=6) Line 377    C
     TeEQ.dll!_mtterm() Line 168    C
     TeEQ.dll!_CRT_INIT(void * hDllHandle=0x64cb0000, unsigned long dwReason=0, void * lpreserved=0x00000000) Line 187    C
     TeEQ.dll!__DllMainCRTStartup(void * hDllHandle=0x64cb0000, unsigned long dwReason=0, void * lpreserved=0x00000000) Line 390    C
     TeEQ.dll!_DllMainCRTStartup(void * hDllHandle=0x64cb0000, unsigned long dwReason=0, void * lpreserved=0x00000000) Line 331    C
     ntdll.dll!_LdrxCallInitRoutine@16()    Unknown
     ntdll.dll!_LdrpCallInitRoutine@16()    Unknown
     ntdll.dll!_LdrpProcessDetachNode@4()    Unknown
     ntdll.dll!_LdrpUnloadNode@4()    Unknown
     ntdll.dll!_LdrpDecrementNodeLoadCount@4()    Unknown
     ntdll.dll!_LdrUnloadDll@4()    Unknown
     KernelBase.dll!_FreeLibrary@4()    Unknown
     Plugin Host.exe!01285922()    Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for Plugin Host.exe]    
     Plugin Host.exe!01285d98()    Unknown
     Plugin Host.exe!0128802b()    Unknown
     Plugin Host.exe!01283713()    Unknown
     Plugin Host.exe!01272562()    Unknown
     Plugin Host.exe!01282839()    Unknown
     Plugin Host.exe!01283ed4()    Unknown
     Plugin Host.exe!012838af()    Unknown
     Plugin Host.exe!01271428()    Unknown
     Plugin Host.exe!012750f9()    Unknown
     Plugin Host.exe!01274fd8()    Unknown
     Plugin Host.exe!01330d5b()    Unknown
     Plugin Host.exe!01276200()    Unknown
     Plugin Host.exe!012760e6()    Unknown
     Plugin Host.exe!0127563b()    Unknown
     Plugin Host.exe!012ae6d5()    Unknown
     Plugin Host.exe!01275801()    Unknown
     Plugin Host.exe!01344c5a()    Unknown
     kernel32.dll!@BaseThreadInitThunk@12()    Unknown
     ntdll.dll!___RtlUserThreadStart@8()    Unknown
     ntdll.dll!__RtlUserThreadStart@8()    Unknown



I’m running in a similar issue with VS2012:

 	ntdll.dll!77700574()	Unbekannt
 	[Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für ntdll.dll]
 	ntdll.dll!776ba6ec()	Unbekannt
 	kernel32.dll!76c514ad()	Unbekannt
>	Plugin.dll!_free_base(void * pBlock) Zeile 50	C
 	Plugin.dll!_unlock(int locknum) Zeile 366	C

The second line is something like “frames below are possibly incorrect and/or missing because no symbols have been loaded”.
Sometimes no C++ code is shown at all, but only sytem dll files.

It doesn’t happen if the debugger is attached by hand instead of the host being started from VS.