:orphan:
# DMDestroy
Destroys a `DM`.
## Synopsis
```
#include "petscdm.h"
#include "petscdmlabel.h"
#include "petscds.h"
PetscErrorCode DMDestroy(DM *dm)
```
Collective
## Input Parameter
- ***dm -*** the `DM` object to destroy
## See Also
[](ch_dmbase), `DM`, `DMCreate()`, `DMType`, `DMSetType()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`
## Level
developer
## Location
src/dm/interface/dm.c
## Examples
src/dm/dt/dualspace/impls/lagrange/tutorials/ex1.c
src/dm/dt/dualspace/impls/lagrange/tutorials/ex2.c
src/dm/field/tutorials/ex1.c
src/dm/impls/forest/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex10.c
src/dm/impls/plex/tutorials/ex11.c
src/dm/impls/plex/tutorials/ex13.c
src/dm/impls/plex/tutorials/ex14.c
src/dm/impls/plex/tutorials/ex1f90.F90
src/dm/impls/plex/tutorials/ex3f90.F90
## Implementations
DMDestroy_Composite in src/dm/impls/composite/pack.c
DMDestroy_DA in src/dm/impls/da/dadestroy.c
DMDestroy_Forest in src/dm/impls/forest/forest.c
DMDestroy_Moab in src/dm/impls/moab/dmmoab.cxx
DMDestroy_Network in src/dm/impls/network/network.c
DMDestroy_Patch in src/dm/impls/patch/patch.c
DMDestroy_Plex in src/dm/impls/plex/plex.c
DMDestroy_Product in src/dm/impls/product/product.c
DMDestroy_Redundant in src/dm/impls/redundant/dmredundant.c
DMDestroy_Shell in src/dm/impls/shell/dmshell.c
DMDestroy_Sliced in src/dm/impls/sliced/sliced.c
DMDestroy_Stag in src/dm/impls/stag/stag.c
DMDestroy_Swarm in src/dm/impls/swarm/swarm.c
DMDestroy_SNESVI in src/snes/impls/vi/rs/virs.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/interface/dm.c)
[Index of all DM routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)