Creating an intentional memory leak to ensure valgrind is working

This commit is contained in:
Mark Berrill 2015-03-06 09:40:05 -05:00
parent 8a1bb62679
commit 03bd04aa30
2 changed files with 10 additions and 3 deletions

View File

@ -112,10 +112,10 @@ IF( NOT DEFINED N_PROCS )
ENDIF()
# Mac:
IF(APPLE)
find_program(cmd_sys_pro "system_profiler")
find_program(cmd_sys_pro "sysctl")
if(cmd_sys_pro)
execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info)
STRING(REGEX REPLACE "^.*Total Number of Cores: ([0-9]+).*$" "\\1" N_PROCS "${info}")
execute_process(COMMAND ${cmd_sys_pro} hw.physicalcpu OUTPUT_VARIABLE info)
STRING(REGEX REPLACE "^.*hw.physicalcpu: ([0-9]+).*$" "\\1" N_PROCS "${info}")
ENDIF()
ENDIF()
# Windows:

View File

@ -1,5 +1,6 @@
#include <iostream>
#include "common/MPI_Helpers.h"
#include "common/Utilities.h"
int main (int argc, char **argv)
@ -15,6 +16,12 @@ int main (int argc, char **argv)
MPI_Barrier(MPI_COMM_WORLD);
}
// Create a memory leak for valgrind to find
if ( nprocs==1 ) {
double *x = new double[1];
ASSERT(x!=NULL);
}
// set the error code
// Note: the error code should be consistent across all processors
int error = 0;