I'd like to use the debug_heap libraries ( they have proved very handy debugging a port of an RTOS ) but there appears to be a big problem when using C++'s new and delete operators.
This can be easy reproduced as follows.
Create a new project (CCES project in C++)
set the option to "link against heap debugging libraries"
make the main application as follows
adi_heap_debug_disable( _HEAP_HPL_GEN );
adi_heap_debug_enable( _HEAP_STDERR_DIAG );
printf( "malloc'ing 16 bytes\n" );
test = (char *)malloc( 16 );
printf( "free'ing 16 bytes\n" );
free( test );
printf( "new'ing 16 bytes\n" );
test = new char;
printf( "delete'ing 16 bytes\n" );
printf( "didn't get here\n" );
when running this application the console output should be as follows:
malloc'ing 16 bytes
free'ing 16 bytes
new'ing 16 bytes
delete'ing 16 bytes
Heap error in block 0xFF9039A4: allocation type mismatch
Call stack: 0xFFA01CEC 0xFFA00128
A fatal error or exception has occurred.
Description: A heap operation which is incompatible with a previous operation has been detected.
General Type: LibraryError
Specific Type: HeapFunctionMismatch
General Code: 0x7
Specific Code: 0x108
Error Value: 0xff9039a4
Error PC: 0xffa0226a
I have debugged this as far as I can but there is no source for the heap_debug libraries. The fault is raised in the function ___adi_heap_debug_free.
The heap debugs alloc_info block only differs in one location when using malloc and new ( 1 for malloc and 8 for new ).
would it be possible to get the source for the heap debug libraries, or a fix for this issue, or any useful information.
CCES version 18.104.22.168 running on Windows 7 64 bit.
BF609 running on Avnet Finboard.
Emulating with ICE 100-B
Thanks in advance.