:orphan:
# PetscMallocGetStack
returns a pointer to the stack for the location in the program a call to `PetscMalloc()` was used to obtain that memory 
## Synopsis
```
#include "petscsys.h" 
PetscErrorCode PetscMallocGetStack(void *ptr, PetscStack **stack)
```
Not Collective


## Input Parameter

- ***ptr -*** the memory location



## Output Parameter

- ***stack -*** the stack indicating where the program allocated this memory





## See Also
 `PetscMallocGetCurrentUsage()`, `PetscMallocView()`, `PetscMalloc()`, `PetscFree()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/memory/mtr.c.html#PetscMallocGetStack">src/sys/memory/mtr.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/memory/mtr.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)  
