PetscMallocValidate — PETSc 3.25.1 documentation

Skip to main content
`Ctrl`+`K`

# PetscMallocValidate

Test the memory for corruption. This can be called at any time between `PetscInitialize()` and `PetscFinalize()`

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscMallocValidate(int line, const char function[], const char file[])

## Input Parameters

- line - line number where call originated.

- function - name of function calling

- file - file where function is

## Options Database Keys

- -malloc_test - turns this feature on when PETSc was not configured with `--with-debugging=0`

- -malloc_debug - turns this feature on anytime

## Notes

You should generally use `CHKMEMQ` as a short cut for calling this routine.

Error messages are written to `stdout`.

This is only run if `PetscMallocSetDebug()` has been called which is set by `-malloc_test` (if debugging is turned on) or `-malloc_debug` (any time)

No output is generated if there are no problems detected.

## Fortran Notes

The Fortran calling sequence is simply `PetscMallocValidate(ierr)`

## See Also

`CHKMEMQ`, `PetscMalloc()`, `PetscFree()`, `PetscMallocSetDebug()`

## Level

advanced

## Location

src/sys/memory/mtr.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages