Memory 为什么';CudaFree似乎能释放记忆吗?

Memory 为什么';CudaFree似乎能释放记忆吗?,memory,cuda,free,Memory,Cuda,Free,我正在尝试分配设备内存,复制到它,在GPU上执行计算,将结果复制回来,然后释放我分配的设备内存。我想确保我没有超过限制,我想看看共享内存空间中是否有足够的内存来转储几个数组 分配设备内存时,不会返回任何错误。当我使用cudaMemGetInfo检查分配的内存量时,看起来有一个cudamaloc没有分配任何内存。 另外,当我试图释放内存时,看起来只有一个指针被释放 我正在使用matlabMexfunction接口设置GPU内存并启动内核。在这一点上,我甚至没有调用内核,只是返回结果的单位矩阵 cu

我正在尝试分配设备内存,复制到它,在GPU上执行计算,将结果复制回来,然后释放我分配的设备内存。我想确保我没有超过限制,我想看看共享内存空间中是否有足够的内存来转储几个数组

分配设备内存时,不会返回任何错误。当我使用
cudaMemGetInfo
检查分配的内存量时,看起来有一个
cudamaloc
没有分配任何内存。 另外,当我试图释放内存时,看起来只有一个指针被释放

我正在使用matlab
Mexfunction
接口设置GPU内存并启动内核。在这一点上,我甚至没有调用内核,只是返回结果的单位矩阵

cudaError_t cudaErr;
size_t freeMem = 0;
size_t totalMem = 0;
size_t allocMem = 0;
cudaMemGetInfo(&freeMem, &totalMem);  
mexPrintf("Memory avaliable: Free: %lu, Total: %lu\n",freeMem, totalMem);  

/* Pointers for the device memory */
double *devicePulseDelay, *deviceTarDistance, *deviceScattDistance, *deviceScatterers;
double *deviceReceivedReal, *deviceReceivedImag;

/* Allocate memory on the device for the arrays. */
mexPrintf("Allocating memory.\n");
cudaErr = cudaMalloc( (void **) &devicePulseDelay, sizeof(double)*512);
if (cudaErr != cudaSuccess)
{
    mexPrintf("could not allocate memory to devicePulseDelay\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("devicePulseDelay: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMalloc( (void **) &deviceTarDistance, sizeof(double)*512);
if (cudaErr != cudaSuccess)
{
    mexPrintf("could not allocate memory to deviceTarDistance\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("deviceTarDistance: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMalloc( (void **) &deviceScattDistance, sizeof(double)*999*512);
if (cudaErr != cudaSuccess)
{
    mexPrintf("could not allocate memory to deviceScattDistance\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("deviceScattDistance: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMalloc( (void **) &deviceScatterers, sizeof(double)*999);
if (cudaErr != cudaSuccess)
{   
    mexPrintf("could not allocate memory to deviceScatterers\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));
}  
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("deviceScatterers: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMalloc( (void **) &deviceReceivedReal, sizeof(double)*999*512);
if (cudaErr != cudaSuccess)
{
    mexPrintf("could not allocate memory to deviceReceivedReal\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("deviceReceivedReal: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMalloc( (void **) &deviceReceivedImag, sizeof(double)*999*512);
if (cudaErr != cudaSuccess)
{
    mexPrintf("could not allocate memory to deviceReceivedImag\n");   
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("deviceReceivedImag: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n", allocMem, totalMem,(freeMem - allocMem));

/* copy the input arrays across to the device */
mexPrintf("\nCopying memory.\n");
cudaErr = cudaMemcpy(devicePulseDelay, pulseDelay, sizeof(double)*512,cudaMemcpyHostToDevice);
if (cudaErr != cudaSuccess) 
{
    mexPrintf("could not copy to devicePulseDelay\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("devicePulseDelay: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMemcpy(deviceTarDistance, tarDistance, sizeof(double)*512,cudaMemcpyHostToDevice);
if (cudaErr != cudaSuccess) 
{
    mexPrintf("could not copy to deviceTarDistance\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));   
}   
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("deviceTarDistance: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMemcpy(deviceScattDistance, scattDistance, sizeof(double)*999*512,cudaMemcpyHostToDevice);   
if (cudaErr != cudaSuccess)
{  
    mexPrintf("could not copy to deviceScattDistance\n");  
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));  
} 
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("deviceScattDistance: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMemcpy(deviceScatterers, scatterers, sizeof(double)*999,cudaMemcpyHostToDevice); 
if (cudaErr != cudaSuccess) 
{
    mexPrintf("could not copy to deviceScatterers\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));   
}   
cudaMemGetInfo(&allocMem, &totalMem);  
mexPrintf("deviceScatterers: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));  

/* call the kernel */
// launchKernel<<<1,512>>>(........);   

/* retireve the output */  
cudaErr = cudaMemcpy(receivedReal, deviceReceivedReal, sizeof(double)*512*512,cudaMemcpyDeviceToHost);   
if (cudaErr != cudaSuccess)
{   
    mexPrintf("could not copy to receivedReal\n");  
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));  
}
cudaMemGetInfo(&allocMem, &totalMem);   
mexPrintf("receivedReal: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));
cudaErr = cudaMemcpy(receivedImag, deviceReceivedImag, sizeof(double)*512*512,cudaMemcpyDeviceToHost); 
if (cudaErr != cudaSuccess)
{ 
    mexPrintf("could not copy to receivedImag\n");   
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));   
}   
cudaMemGetInfo(&allocMem, &totalMem); 
mexPrintf("receivedImag: Memory avaliable: Free: %lu, Total: %lu, Consumed: %lu\n",allocMem, totalMem,(freeMem - allocMem));   

/* free the memory. */ 
mexPrintf("\nFree'ing memory.\n");   
cudaMemGetInfo(&freeMem, &totalMem);  
mexPrintf("Before freeing: Free %lu, Total: %lu\n", freeMem, totalMem);  
cudaErr = cudaFree(devicePulseDelay); 
if (cudaErr != cudaSuccess) 
{ 
    mexPrintf("could free devicePulseDelay\n");   
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));  
}   
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("devicePulseDelay: Memory avaliable: Free: %lu, Total: %lu, Free'd: %lu\n",allocMem, totalMem,(allocMem - freeMem));   
cudaErr = cudaFree(deviceTarDistance);   
if (cudaErr != cudaSuccess) 
{
    mexPrintf("could free deviceTarDistance\n");  
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));  
} 
cudaMemGetInfo(&allocMem, &totalMem);   
mexPrintf("deviceTarDistance: Memory avaliable: Free: %lu, Total: %lu, Free'd: %lu\n",allocMem, totalMem,(allocMem - freeMem));  
cudaErr = cudaFree(deviceScattDistance);   
if (cudaErr != cudaSuccess) 
{   
    mexPrintf("could free deviceScattDistance\n"); 
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));
}   
cudaMemGetInfo(&allocMem, &totalMem);   
mexPrintf("deviceScattDistance: Memory avaliable: Free: %lu, Total: %lu, Free'd: %lu\n",allocMem, totalMem,(allocMem - freeMem));  
cudaErr = cudaFree(deviceScatterers);  
if (cudaErr != cudaSuccess) 
{   
    mexPrintf("could free deviceScatterers\n");  
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));   
}   
cudaMemGetInfo(&allocMem, &totalMem);  
mexPrintf("deviceScatterers: Memory avaliable: Free: %lu, Total: %lu, Free'd: %lu\n",allocMem, totalMem,(allocMem - freeMem));  
cudaErr = cudaFree(deviceReceivedReal);  
if (cudaErr != cudaSuccess) 
{  
    mexPrintf("could free deviceReceivedReal\n"); 
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));  
} 
cudaMemGetInfo(&allocMem, &totalMem);  
mexPrintf("deviceReceivedReal: Memory avaliable: Free: %lu, Total: %lu, Free'd: %lu\n",allocMem, totalMem,(allocMem - freeMem));   
cudaErr = cudaFree(deviceReceivedImag);   
if (cudaErr != cudaSuccess) 
{ 
    mexPrintf("could free deviceReceivedImag\n");
    mexPrintf("Error: %s\n",cudaGetErrorString(cudaErr));  
}   
cudaMemGetInfo(&allocMem, &totalMem);
mexPrintf("deviceReceivedImag: Memory avaliable: Free: %lu, Total: %lu, Free'd: %lu\n",allocMem, totalMem,(allocMem - freeMem));
cudaError\u t cudaErr;
尺寸=0;
大小\u t totalMem=0;
大小\u t allocMem=0;
cudaMemGetInfo(&freemm,&totalMem);
mexPrintf(“可用内存:可用:%lu,总计:%lu\n”,可用内存,总计内存);
/*设备内存的指针*/
双*设备脉冲显示,*设备标准,*设备散射距离,*设备散射器;
双*deviceReceivedReal,*deviceReceivedImag;
/*在设备上为阵列分配内存*/
mexPrintf(“分配内存。\n”);
cudaErr=cudamaloc((void**)和devicePulseDelay,sizeof(double)*512);
如果(cudaErr!=cudaSuccess)
{
mexPrintf(“无法将内存分配给devicePulseDelay\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“devicePulseDelay:内存可用:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
cudaErr=cudaMalloc((无效**)和设备标准,尺寸(双)*512);
如果(cudaErr!=cudaSuccess)
{
mexPrintf(“无法将内存分配给设备状态\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“设备状态:可用内存:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
cudaErr=cudamaloc((void**)和DeviceScatDistance,sizeof(double)*999*512);
如果(cudaErr!=cudaSuccess)
{
mexPrintf(“无法将内存分配给DeviceScatDistance\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“DeviceScatDistance:内存可用:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
cudaErr=cudaMalloc((无效**)和设备散射器,尺寸(双)*999;
如果(cudaErr!=cudaSuccess)
{   
mexPrintf(“无法将内存分配给DeviceScatters\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}  
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“DeviceCatterers:可用内存:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
cudaErr=cudamaloc((void**)和deviceReceivedReal,sizeof(double)*999*512);
如果(cudaErr!=cudaSuccess)
{
mexPrintf(“无法将内存分配给deviceReceivedReal\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“DeviceReceiveReal:内存可用:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
cudaErr=CUDAMALOC((无效**)和设备接收图像,大小(双)*999*512);
如果(cudaErr!=cudaSuccess)
{
mexPrintf(“无法将内存分配给deviceReceivedImag\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“deviceReceivedImag:内存可用:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
/*将输入阵列复制到设备上*/
mexPrintf(“\n复制内存。\n”);
cudaErr=cudaMemcpy(设备脉冲显示、脉冲延迟、大小(双)*512,cudaMemcpy主机设备);
如果(cudaErr!=cudaSuccess)
{
mexPrintf(“无法复制到devicePulseDelay\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“devicePulseDelay:内存可用:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
cudaErr=cudaMemcpy(设备坐标、tarDistance、sizeof(双精度)*512,cudaMemcpyHostToDevice);
如果(cudaErr!=cudaSuccess)
{
mexPrintf(“无法复制到设备状态\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}   
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“设备状态:可用内存:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
cudaErr=cudaMemcpy(设备散射距离、散射距离、大小(双)*999*512,CUDAMEMCPYHOSTTO设备);
如果(cudaErr!=cudaSuccess)
{  
mexPrintf(“无法复制到DeviceScatDistance\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
} 
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“DeviceScatDistance:内存可用:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
cudaErr=cudaMemcpy(设备散射器、散射器、大小(双)*999,cudaMemcpyHostToDevice);
如果(cudaErr!=cudaSuccess)
{
mexPrintf(“无法复制到DeviceScatters\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}   
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“DeviceCatterers:可用内存:可用:%lu,总计:%lu,消耗:%lu\n”),allocMem,totalMem,(freeMem-allocMem));
/*调用内核*/
//启动内核(………);
/*退出输出*/
cudaErr=cudaMemcpy(receivedReal,deviceReceivedReal,sizeof(double)*512*512,cudaMemcpyDeviceToHost);
如果(cudaErr!=cudaSuccess)
{   
mexPrintf(“无法复制到receivedReal\n”);
mexPrintf(“错误:%s\n”,cudaGetErrorString(cudaErr));
}
cudaMemGetInfo(&allocMem,&totalMem);
mexPrintf(“receivedReal:Memory Available:Free:%lu,Total:%lu,Consumed:%lu\n”),allocMem,tot
Memory avaliable: Free: 2523959296, Total: 2818572288
 Allocating memory.
 devicePulseDelay: Memory avaliable: Free: 2522910720, Total: 2818572288, Consumed: 1048576
 deviceTarDistance: Memory avaliable: Free: 2522910720, Total: 2818572288, Consumed: 1048576
 deviceScattDistance: Memory avaliable: Free: 2518716416, Total: 2818572288, Consumed: 5242880
 deviceScatterers: Memory avaliable: Free: 2517667840, Total: 2818572288, Consumed: 6291456
 deviceReceivedReal: Memory avaliable: Free: 2515570688, Total: 2818572288, Consumed: 8388608
 deviceReceivedImag: Memory avaliable: Free: 2513473536, Total: 2818572288, Consumed: 10485760

Copying memory.
 devicePulseDelay: Memory avaliable: Free: 2513473536, Total: 2818572288, Consumed: 10485760
 deviceTarDistance: Memory avaliable: Free: 2513473536, Total: 2818572288, Consumed: 10485760
 deviceScattDistance: Memory avaliable: Free: 2513473536, Total: 2818572288, Consumed: 10485760
 deviceScatterers: Memory avaliable: Free: 2513473536, Total: 2818572288, Consumed: 10485760
 receivedReal: Memory avaliable: Free: 2513473536, Total: 2818572288, Consumed: 10485760
 receivedImag: Memory avaliable: Free: 2513473536, Total: 2818572288, Consumed: 10485760

Free'ing memory.
 Before freeing: Free 2513473536, Total: 2818572288
 devicePulseDelay: Memory avaliable: Free: 2513473536, Total: 2818572288, Free'd: 0
 deviceTarDistance: Memory avaliable: Free: 2513473536, Total: 2818572288, Free'd: 0
 deviceScattDistance: Memory avaliable: Free: 2513473536, Total: 2818572288, Free'd: 0
 deviceScatterers: Memory avaliable: Free: 2514522112, Total: 2818572288, Free'd: 1048576
 deviceReceivedReal: Memory avaliable: Free: 2514522112, Total: 2818572288, Free'd: 1048576
 deviceReceivedImag: Memory avaliable: Free: 2514522112, Total: 2818572288, Free'd: 1048576
#include <cstdio>

#define mexPrintf printf

inline void gpuAssert(cudaError_t code, char *file, int line, 
                 bool abort=true)
{
   if (code != cudaSuccess) 
   {
      mexPrintf("GPUassert: %s %s %d\n", cudaGetErrorString(code),
          file, line);
      if (abort) exit(code);
   }
}

#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }

inline void gpuMemReport(size_t * avail, size_t * total, 
        const char * title = 0, const size_t * free = 0, const bool sense = true) 
{
    char tstring[32] = { '\0' };
    gpuErrchk( cudaMemGetInfo(avail, total) );  

    if (free) {
        if (title) {
            strncpy(tstring, title, 31);
        }
        mexPrintf("%s Memory avaliable: Free: %zu, Total: %zu, %s: %zu\n",
                tstring, *avail, *total, (sense) ? "Allocated\0" : "Freed\0", 
                (sense) ? (*free - *avail) : (*avail - *free));
    } else {
        mexPrintf("Memory avaliable: Free: %zu, Total: %zu\n", *avail, *total);  
    }
}

int main()
{
    size_t freeMem = 0;
    size_t totalMem = 0;
    size_t allocMem = 0;

    gpuErrchk( cudaFree(0) );
    gpuMemReport(&freeMem, &totalMem);

    double *devicePulseDelay, *deviceTarDistance, *deviceScattDistance, *deviceScatterers;
    double *deviceReceivedReal, *deviceReceivedImag;

    mexPrintf("Allocating memory.\n");
    gpuErrchk( cudaMalloc( (void **) &devicePulseDelay, sizeof(double)*512) );
    gpuMemReport(&allocMem, &totalMem, "devicePulseDelay:", &freeMem);

    gpuErrchk( cudaMalloc( (void **) &deviceTarDistance, sizeof(double)*512) );
    gpuMemReport(&allocMem, &totalMem, "deviceTarDistance:", &freeMem);

    gpuErrchk( cudaMalloc( (void **) &deviceScattDistance, sizeof(double)*999*512) );
    gpuMemReport(&allocMem, &totalMem, "deviceScattDistance:", &freeMem);

    gpuErrchk( cudaMalloc( (void **) &deviceScatterers, sizeof(double)*999) );
    gpuMemReport(&allocMem, &totalMem, "deviceScatterers:", &freeMem);

    gpuErrchk( cudaMalloc( (void **) &deviceReceivedReal, sizeof(double)*999*512) );
    gpuMemReport(&allocMem, &totalMem, "deviceReceivedReal:", &freeMem);

    gpuErrchk( cudaMalloc( (void **) &deviceReceivedImag, sizeof(double)*999*512) );
    gpuMemReport(&allocMem, &totalMem, "deviceReceivedImag:", &freeMem);

    mexPrintf("\nFree'ing memory.\n");   
    gpuMemReport(&freeMem, &totalMem);

    gpuErrchk( cudaFree(devicePulseDelay) ); 
    gpuMemReport(&allocMem, &totalMem, "devicePulseDelay:", &freeMem, false);

    gpuErrchk( cudaFree(deviceTarDistance) ); 
    gpuMemReport(&allocMem, &totalMem, "deviceTarDistance:", &freeMem, false);

    gpuErrchk( cudaFree(deviceScattDistance) ); 
    gpuMemReport(&allocMem, &totalMem, "deviceScattDistance:", &freeMem, false);

    gpuErrchk( cudaFree(deviceScatterers) ); 
    gpuMemReport(&allocMem, &totalMem, "deviceScatterers:", &freeMem, false);

    gpuErrchk( cudaFree(deviceReceivedReal) ); 
    gpuMemReport(&allocMem, &totalMem, "deviceReceivedReal:", &freeMem, false);

    gpuErrchk( cudaFree(deviceReceivedImag) ); 
    gpuMemReport(&allocMem, &totalMem, "deviceReceivedImag:", &freeMem, false);

    return 0;
}
Allocating memory.
devicePulseDelay: Memory avaliable: Free: 202870784, Total: 265027584, Allocated: 1048576
deviceTarDistance: Memory avaliable: Free: 202870784, Total: 265027584, Allocated: 1048576
deviceScattDistance: Memory avaliable: Free: 198778880, Total: 265027584, Allocated: 5140480
deviceScatterers: Memory avaliable: Free: 197730304, Total: 265027584, Allocated: 6189056
deviceReceivedReal: Memory avaliable: Free: 193638400, Total: 265027584, Allocated: 10280960
deviceReceivedImag: Memory avaliable: Free: 189546496, Total: 265027584, Allocated: 14372864

Free'ing memory.
Memory avaliable: Free: 189546496, Total: 265027584
devicePulseDelay: Memory avaliable: Free: 189546496, Total: 265027584, Freed: 0
deviceTarDistance: Memory avaliable: Free: 190595072, Total: 265027584, Freed: 1048576
deviceScattDistance: Memory avaliable: Free: 194686976, Total: 265027584, Freed: 5140480
deviceScatterers: Memory avaliable: Free: 195735552, Total: 265027584, Freed: 6189056
deviceReceivedReal: Memory avaliable: Free: 199827456, Total: 265027584, Freed: 10280960
deviceReceivedImag: Memory avaliable: Free: 203919360, Total: 265027584, Freed: 14372864