:orphan:
# PetscMemoryGetCurrentUsage
Returns the current resident set size (memory used) for the program. 
## Synopsis
```
#include "petscsys.h" 
PetscErrorCode PetscMemoryGetCurrentUsage(PetscLogDouble *mem)
```
Not Collective


## Output Parameter

- ***mem -*** memory usage in bytes



## Options Database Key

- ***-memory_view -*** Print memory usage at end of run
- ***-log_view_memory -*** Display memory information for each logged event
- ***-malloc_log -*** Activate logging of memory usage





## Notes
The memory usage reported here includes all Fortran arrays
(that may be used in application-defined sections of code).
This routine thus provides a more complete picture of memory
usage than `PetscMallocGetCurrentUsage()` for codes that employ Fortran with
hardwired arrays.

This value generally never decreases during a run even if the application has freed much of its memory that it allocated


## See Also
 `PetscMallocGetMaximumUsage()`, `PetscMemoryGetMaximumUsage()`, `PetscMallocGetCurrentUsage()`, `PetscMemorySetGetMaximumUsage()`, `PetscMemoryView()`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex11.c.html">src/ts/tutorials/ex11.c</A><BR>


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