petsc-3.4.2 2013-07-02

# PetscMalloc

Allocates memory

### 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

If you request memory of zero size it will allocate no space and assign the pointer to 0; PetscFree() will properly handle not freeing the null pointer.

### See Also

PetscFree(), PetscNew()

Level:beginner
Location:include/petscsys.h
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/sys/classes/random/examples/tutorials/ex1.c.html
src/sys/threadcomm/examples/tutorials/ex1.c.html
src/sys/threadcomm/examples/tutorials/ex2.c.html
src/sys/threadcomm/examples/tutorials/ex3.c.html
src/sys/threadcomm/examples/tutorials/ex5.c.html
src/vec/vec/examples/tutorials/ex6.c.html
src/vec/vec/examples/tutorials/ex8.c.html
src/vec/vec/examples/tutorials/ex9.c.html
src/vec/is/is/examples/tutorials/ex1.c.html
src/vec/is/sf/examples/tutorials/ex1.c.html
src/mat/examples/tutorials/ex2.c.html