:orphan:
# PetscGetMemType
Query the `PetscMemType` of a pointer 
## Synopsis
```
#include <petscdevice.h> 
PetscErrorCode PetscGetMemType(const void *ptr, PetscMemType *type)
```
Not Collective


## Input Parameter

- ***ptr -*** The pointer to query (may be `NULL`)



## Output Parameter

- ***type -*** The `PetscMemType` of the pointer



## Notes
Currently only CUDA and HIP memtypes are supported.




## See Also
so: `PetscMemType`, `PetscDeviceMalloc()`, `PetscDeviceCalloc()`, `PetscDeviceFree()`,
`PetscDeviceArrayCopy()`, `PetscDeviceArrayZero()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/device/util/memory.c.html#PetscGetMemType">src/sys/objects/device/util/memory.c</A>


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