Skip to main content
Ctrl+K
PETSc 3.23.1 documentation - Home
  • Overview
  • Install
  • Tutorials
  • User-Guide
  • C/Fortran API
  • petsc4py API
  • FAQ
  • Community
  • Developers
  • Misc.
  • GitLab
  • Overview
  • Install
  • Tutorials
  • User-Guide
  • C/Fortran API
  • petsc4py API
  • FAQ
  • Community
  • Developers
  • Misc.
  • GitLab
  • PetscFree

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 success)

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(), PetscMalloc1(), PetscCalloc1()

Level#

beginner

Location#

include/petscsys.h

Examples#

src/dm/impls/plex/tutorials/ex10.c
src/dm/impls/plex/tutorials/ex6.c
src/dm/tutorials/ex14.c
src/dm/impls/plex/tutorials/ex15.c
src/dm/field/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex14.c
src/dm/impls/stag/tutorials/ex4.c
src/dm/tutorials/ex26.c
src/dm/label/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex8.c


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

On this page
  • Synopsis
  • Input Parameter
  • Notes
  • See Also
  • Level
  • Location
  • Examples
Edit on GitLab
Show Source

© Copyright 1991-2025, UChicago Argonne, LLC and the PETSc Development Team.

Created using Sphinx 7.3.7.

Built with the PyData Sphinx Theme 0.15.1.

Last updated on 2025-04-30T13:10:40-0500 (v3.23.1).