# PetscDeviceRegisterMemory
Register a pointer for use with device-aware memory system 
## Synopsis
```
#include <petscdevice.h> 
PetscErrorCode PetscDeviceRegisterMemory(const void *PETSC_RESTRICT ptr, PetscMemType mtype, std::size_t size)
```
Not Collective


## Input Parameters

- ***ptr   -*** The pointer to register
- ***mtype -*** The `PetscMemType` of the pointer
- ***size  -*** The size (in bytes) of the memory region



## Notes
`ptr` need not point to the beginning of the memory range, however the user should register
the

It's OK to re-register the same `ptr` repeatedly (subsequent registrations do nothing)
however the given `mtype` and `size` must match the original registration.

`size` may be 0 (in which case this routine does nothing).




## See Also
 `PetscDeviceMalloc()`, `PetscDeviceArrayCopy()`, `PetscDeviceFree()`,
`PetscDeviceArrayZero()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/device/interface/memory.cxx.html#PetscDeviceRegisterMemory">src/sys/objects/device/interface/memory.cxx</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/device/interface/memory.cxx)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
