Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Why Inspector reports mismatched allocation and deallocation for simple code like this

xman_hawkeye
Beginner
1,335 Views

Why Inspector complain about this code fro mismatched alloc/dealloc?  Very strange to me.

 

int _tmain(int argc, _TCHAR* argv[])
{
    int *p = NULL;
    p = new int[5];
    delete[] p;

    return 0;
}

0 Kudos
4 Replies
xman_hawkeye
Beginner
1,335 Views

Just FYI, build with Debug and Inspector doesn't complain about it.

0 Kudos
xman_hawkeye
Beginner
1,335 Views

Ah, I was using Visual C++ compiler.  After switching to Intel Compiler, the false warning is gone for both Release and Debug.  Anyone cares to explain why?  Thanks.

0 Kudos
Kevin_O_Intel1
Employee
1,335 Views

 

It looks like Inspector thinks you are allocating using "new" instead of "new[]".

Depending on the compiler and the header files you are using it can difficult to disambiguate the symbol names.

As you mention it looks like a false warning in this case.

Let me know if you have any questions.

Regards,

Kevin

0 Kudos
xman_hawkeye
Beginner
1,335 Views

Thanks for replying.  No more issues after switching to Intel compilers.  

0 Kudos
Reply