Skip to main content
`Ctrl`+`K`

# PetscMemoryGetMaximumUsage

Returns the maximum resident set size (memory used) for the program since it started (the high water mark).

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscMemoryGetMaximumUsage(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 - Print memory information per event

- -malloc_view - Print usage of `PetscMalloc()` in `PetscFinalize()`

## Note

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.

## See Also

`PetscMallocGetMaximumUsage()`, `PetscMemoryGetCurrentUsage()`, `PetscMallocGetCurrentUsage()`, `PetscMemorySetGetMaximumUsage()`

## Level

intermediate

## Location

src/sys/memory/mem.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages