:orphan: # PetscObjectDelayedDestroy Adds an object to a data structure for later destruction. ## Synopsis ``` PetscErrorCode PetscObjectDelayedDestroy(PetscObject *obj) ``` Not Collective ## Input Parameter - ***obj -*** object to be destroyed ## Notes Analogue to `PetscObjectDestroy()` for use in managed languages. A PETSc object is given a creation index at initialisation based on the communicator it was created on and the order in which it is created. When this function is passed a PETSc object, a pointer to the object is stashed on a garbage dictionary (`PetscHMapObj`) which is keyed by its creation index. Objects stashed on this garbage dictionary can later be destroyed with a call to `PetscGarbageCleanup()`. This function is intended for use with managed languages such as Python or Julia, which may not destroy objects in a deterministic order. ## See Also `PetscGarbageCleanup()`, `PetscObjectDestroy()` ## Level developer ## Location src/sys/objects/garbage.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/garbage.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)