False Positives: _mm_malloc and _mm_free

False Positives: _mm_malloc and _mm_free

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?
 

 

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Anyone looked into this yet?

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;
}

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today