Community
cancel
Showing results for 
Search instead for 
Did you mean: 
浩章_澤_
Beginner
68 Views

Memory leak when using offload in Intel HD Graphics 4600

My software using cilk_for occured memory leak.

I want to know why memory leaks and how avoid memory leak.

Thanks.

source code:

#include <cilk/cilk.h>
#include <iostream>
#include <windows.h>

int main()
{
 int retVal = 0;

 unsigned char* input = NULL;
 input = (unsigned char *)_aligned_malloc(sizeof(unsigned char)*100, 32);

 do {

#pragma offload target(gfx) pin(input:length(100))
#pragma simd
#pragma unroll(3)
  cilk_for(int i = 0; i < 100; ++i) {
   cilk_for(int j = 0; j < 100; ++j) {
    cilk_for(int k = 0; k < 100; ++k) {
    }
   }
  }
  
  MEMORYSTATUSEX mem = {sizeof mem};
  GlobalMemoryStatusEx(&mem);
  unsigned int m = static_cast<unsigned int>((512 * 1024) + (mem.ullTotalVirtual - mem.ullAvailVirtual));
  std::cout << m << " Bytes using" << std::endl;
 } while(true);

 if(input != NULL) {
  _aligned_free(input);
  input = NULL;
 }

 return retVal;
}

CPU: core i7-4770S

Driver:Intel HD Gprahics 4600 10.18.14.4578 (latest)

OS: Windows 7 professional SP1 64bit

IDE: Visual Studio 2012 Professional, Intel Parallel Studio XE 2017

Software platform: x64

0 Kudos
0 Replies
Reply