petsc-3.12.1 2019-10-22
Report Typos and Errors

# CHKMEMQ

Checks the memory for corruption, calls error handler if any is detected

### Synopsis

    #include <petscsys.h>
    CHKMEMQ;

Not Collective

### Notes

We highly recommend using valgrind https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind for finding memory problems. This is useful on systems that do not have valgrind, but much much less useful.

Must run with the option -malloc_debug (-malloc_test in debug mode; or if PetscMallocSetDebug() called) to enable this option

Once the error handler is called the calling function is then returned from with the given error code.

By defaults prints location where memory that is corrupted was allocated.

Use CHKMEMA for functions that return void

### See Also

PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3(),
PetscMallocValidate()

### Level

beginner

### Location

src/sys/error/../../../include/petscerror.h

### Examples

src/dm/examples/tutorials/ex11f90.F90.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages