:orphan:
# PetscMallocClear
Resets the routines used by `PetscMalloc()` and `PetscFree()` 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscMallocClear(void)
```
Not Collective




## Notes
In general one should never run a PETSc program with different `malloc()` and
`free()` settings for different parts; this is because one NEVER wants to
`free()` an address that was malloced by a different memory management system

Called in `PetscFinalize()` so that if `PetscInitialize()` is called again it starts with a fresh slate of allocation information


## See Also
 `PetscMallocSet()`, `PetscMalloc()`, `PetscFree()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/memory/mal.c.html#PetscMallocClear">src/sys/memory/mal.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/memory/mal.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
