petsc-3.10.5 2019-03-28
Report Typos and Errors

# PetscFree

Frees memory

### Synopsis

    #include <petscsys.h>
    PetscErrorCode PetscFree(void *memory)

Not Collective

### Input Parameter

memory -memory to free (the pointer is ALWAYS set to NULL upon sucess)

### Notes

Do not free memory obtained with PetscMalloc2(), PetscCalloc2() etc, they must be freed with PetscFree2() etc.

It is safe to call PetscFree() on a NULL pointer.

### See Also

PetscNew(), PetscMalloc(), PetscNewLog(), PetscMalloc1(), PetscCalloc1()

### Level

beginner

### Location

include/petscsys.h

### Examples

src/sys/classes/random/examples/tutorials/ex1.c.html
src/sys/classes/random/examples/tutorials/ex2.c.html
src/vec/vec/utils/tagger/examples/tutorials/ex1.c.html
src/vec/vec/examples/tutorials/ex6.c.html
src/vec/vec/examples/tutorials/ex8.c.html
src/vec/vec/examples/tutorials/ex9.c.html
src/vec/is/is/examples/tutorials/ex1.c.html
src/mat/examples/tutorials/ex2.c.html
src/mat/examples/tutorials/ex5.c.html
src/mat/examples/tutorials/ex10.c.html
src/mat/examples/tutorials/ex12.c.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages