Skip to main content
`Ctrl`+`K`

# PetscObjectDereference

Indicates to any `PetscObject` that it is being referenced by one less `PetscObject`. This decreases the reference count for that object by one.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscObjectDereference(PetscObject obj)

Collective on `obj` if reference reaches 0 otherwise Logically Collective

## Input Parameter

- obj - the PETSc object; this must be cast with (`PetscObject`), for example, `PetscObjectDereference`((`PetscObject`)mat);

## Notes

`PetscObjectDestroy()` sets the `obj` pointer to `NULL` after the call, this routine does not.

If `obj` is `NULL` this function returns without doing anything.

## See Also

`PetscObjectCompose()`, `PetscObjectReference()`, `PetscObjectDestroy()`, `PetscObject`

## Level

advanced

## Location

src/sys/objects/inherit.c

## Examples

src/snes/tutorials/ex35.c

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