# Heap Memory problems. debugging Plugins

**URL:** https://forum.juce.com/t/heap-memory-problems-debugging-plugins/11848
**Category:** General JUCE discussion
**Created:** [November 13, 2013, 12:05pm UTC](https://forum.juce.com/t/heap-memory-problems-debugging-plugins/11848 "2013-11-13T12:05:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)
#### Post date: [November 13, 2013, 12:05pm UTC](https://forum.juce.com/t/heap-memory-problems-debugging-plugins/11848/1 "2013-11-13T12:05:06Z")

</div>

This problem may related to&nbsp;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.&nbsp;

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)
#### Post date: [November 13, 2013, 12:10pm UTC](https://forum.juce.com/t/heap-memory-problems-debugging-plugins/11848/2 "2013-11-13T12:10:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)
#### Post date: [November 13, 2013, 12:27pm UTC](https://forum.juce.com/t/heap-memory-problems-debugging-plugins/11848/3 "2013-11-13T12:27:30Z")

</div>

mostly &nbsp;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  
&nbsp;

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

&nbsp;

---

<div class="post-metadata">

### Author: ![lkjb](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@lkjb](https://forum.juce.com/u/lkjb)
#### Post date: [November 13, 2013, 4:50pm UTC](https://forum.juce.com/t/heap-memory-problems-debugging-plugins/11848/4 "2013-11-13T16:50:17Z")

</div>

I’m running in a similar issue with VS2012:

```auto
 	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.
