PetscMalloc3 — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# PetscMalloc3

Allocates 3 arrays of memory, all aligned to `PETSC_MEMALIGN`

## Synopsis

    #include <petscsys.h>
    PetscErrorCode PetscMalloc3(size_t m1,type **r1,size_t m2,type **r2,size_t m3,type **r3)

Not Collective

## Input Parameters

- m1 - number of elements to allocate in 1st chunk (may be zero)

- m2 - number of elements to allocate in 2nd chunk (may be zero)

- m3 - number of elements to allocate in 3rd chunk (may be zero)

## Output Parameters

- r1 - memory allocated in first chunk

- r2 - memory allocated in second chunk

- r3 - memory allocated in third chunk

## See Also

`PetscFree()`, `PetscNew()`, `PetscMalloc()`, `PetscMalloc2()`, `PetscCalloc3()`, `PetscFree3()`

## Level

developer

## Location

include/petscsys.h

## Examples

src/ts/tutorials/extchem.c
src/ksp/ksp/tutorials/ex35.cxx
src/ts/tutorials/extchemfield.c
src/ksp/ksp/tutorials/ex74.c
src/ts/tutorials/ex9.c
src/ksp/ksp/tutorials/ex36.cxx
src/vec/is/sf/tutorials/ex1.c
src/ts/tutorials/ex18.c

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