Skip to content
Snippets Groups Projects
Commit 5fcf26ec authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Fixing Memleak check on HeapMemory

parent 5e772382
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
mkdir ${HOME}/MPI
wget http://www.open-mpi.de/software/ompi/v1.8/downloads/openmpi-1.8.1.tar.bz2
tar -xvf openmpi-1.8.1.tar.bz2
cd openmpi-1.8.1
wget http://www.open-mpi.de/software/ompi/v1.8/downloads/openmpi-1.8.7.tar.bz2
tar -xvf openmpi-1.8.7.tar.bz2
cd openmpi-1.8.7
sh ./configure --prefix=${HOME}/MPI --enable-opal-multi-threads --enable-mpi-f90
make
make install
......@@ -41,7 +41,7 @@ void CudaMemory::destroy()
{
//! we invalidate hm
CUDA_SAFE_CALL(cudaFreeHost(hm));
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
//! remove hm
check_delete(hm);
#endif
......@@ -60,7 +60,7 @@ void CudaMemory::allocate_host(size_t sz)
if (hm == NULL)
{
CUDA_SAFE_CALL(cudaHostAlloc(&hm,sz,cudaHostAllocMapped))
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
//! add hm to the list of allocated memory
check_new(hm,sz);
#endif
......
......@@ -12,7 +12,7 @@
#include <cstdint>
// If debugging mode include memory leak check
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
#include "Memleak_check.hpp"
#endif
......@@ -29,7 +29,7 @@ bool HeapMemory::allocate(size_t sz)
dmOrig = new byte[sz+alignement];
dm = dmOrig;
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
check_new(dmOrig,sz+alignement);
#endif
......@@ -61,7 +61,7 @@ void HeapMemory::destroy()
if (dmOrig != NULL)
delete [] dmOrig;
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
check_delete(dmOrig);
#endif
}
......@@ -168,6 +168,9 @@ bool HeapMemory::resize(size_t sz)
byte * tdm;
byte * tdmOrig;
tdmOrig = new byte[sz+alignement];
#ifdef SE_CLASS2
check_new(tdmOrig,sz+alignement);
#endif
tdm = tdmOrig;
//! size plus alignment
......
......@@ -15,7 +15,7 @@
#include <cstdint>
// If debugging mode include memory leak check
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
#include "Memleak_check.hpp"
#endif
......
......@@ -35,7 +35,7 @@
#include <cstdint>
#include <iostream>
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
#include "Memleak_check.hpp"
#endif
......@@ -104,7 +104,7 @@ public:
// Default constructor
PtrMemory():spm(0),dm(NULL),sz(0),ref_cnt(0)
{
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
if (process_to_print == process_v_cl)
std::cout << "Creating PtrMemory: " << this << "\n";
#endif
......@@ -113,7 +113,7 @@ public:
//! Constructor, we choose a default alignment of 32 for avx
PtrMemory(void * ptr, size_t sz):spm(sz),dm(ptr),sz(0),ref_cnt(0)
{
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
if (process_to_print == process_v_cl)
std::cout << "Creating PtrMemory: " << this << "\n";
#endif
......@@ -121,7 +121,7 @@ public:
~PtrMemory()
{
#ifdef MEMLEAK_CHECK
#ifdef SE_CLASS2
if (process_to_print == process_v_cl)
std::cout << "Delete PtrMemory: " << this << "\n";
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment