petsc-3.13.6 2020-09-29
Report Typos and Errors

PetscMalloc

Allocates memory, One should use PetscNew(), PetscMalloc1() or PetscCalloc1() usually instead of this

Synopsis

#include <petscsys.h>
PetscErrorCode PetscMalloc(size_t m,void **result)
Not Collective

Input Parameter

m -number of bytes to allocate

Output Parameter

result -memory allocated

Notes

Memory is always allocated at least double aligned

It is safe to allocate size 0 and pass the resulting pointer (which may or may not be NULL) to PetscFree().

See Also

PetscFree(), PetscNew()

Level

beginner

Location

include/petscsys.h

Examples

src/snes/tutorials/ex62.c.html
src/ts/tutorials/ex8.c.html
src/ts/tutorials/ex11.c.html
src/tao/tutorials/ex1.c.html
src/tao/tutorials/ex2.c.html
src/tao/tutorials/ex3.c.html

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