Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4995 Discussions

False Positives: _mm_malloc and _mm_free

Nico_S_
Beginner
721 Views

Good day. Just started using Inspector (Update 2 build 550070).
After running Locate Memory Problems I always get false positives for _mm_malloc (memory leak) and _mm_free (missing allocation).

To verify the following code also reports false positives:

unsigned char *hostPtr = (unsigned char*)_mm_malloc((((1280 * 960) * sizeof(unsigned char)) + 63) & (-64), 4096);
hostPtr[100] = 0xFF;
_mm_free(hostPtr);

I don't want to just suppress the errors since to me it looks like Inspector should handle this correctly. Tested with malloc and free and Inspector works as expected.

How do I resolve this?
 

 

0 Kudos
2 Replies
Rodolfo_N_1
Beginner
721 Views

Anyone looked into this yet?

0 Kudos
Galimullin__Marsel
721 Views

Hello! I have similar problem with  VirtualAlloc and VirtualFree.
When I build x86 version of a program, Inspector show me "Memory leak" in line of VirtualAlloc, but in x64 version all Ok.
My code:

#include <iostream>
#include <Windows.h>

#define VMALLOC(size) VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE)  
#define VMFREE(p) VirtualFree(p, 0, MEM_RELEASE)  

int main(int argc, char* argv[])
{
     SYSTEM_INFO sSysInfo;
     GetSystemInfo(&sSysInfo);
     const DWORD dwPageSize = sSysInfo.dwPageSize;

     void* mem = VMALLOC(dwPageSize);

     if (!mem)
     {
          std::cout << "Failed to allocate memory" << std::endl;
          return -1;
     }
   
     if (!VMFREE(mem))
     {
          std::cout << "Failed to free memory" << std::endl;
          return -1;
     }
     
     std::cout << "Done" << std::endl;

     return 0;
}

 

0 Kudos
Reply