# PetscMallocA
Allocate and optionally clear one or more objects, possibly using coalesced malloc 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscMallocA(int n, PetscBool clear, int lineno, const char *function, const char *filename, size_t bytes0, void *ptr0, ...)
```
Not Collective


## Input Parameters

- ***n -*** number of objects to allocate (at least 1)
- ***clear -*** use calloc() to allocate space initialized to zero
- ***lineno -*** line number to attribute allocation (typically __LINE__)
- ***function -*** function to attribute allocation (typically PETSC_FUNCTION_NAME)
- ***filename -*** file name to attribute allocation (typically __FILE__)
- ***bytes0 -*** first of n object sizes



## Output Parameters

- ***ptr0 -*** first of n pointers to allocate


Notes
This function is not normally called directly by users, but rather via the macros `PetscMalloc1()`, `PetscMalloc2()`, or `PetscCalloc1()`, etc.




## See Also
 `PetscMallocAlign()`, `PetscMallocSet()`, `PetscMalloc1()`, `PetscMalloc2()`, `PetscMalloc3()`, `PetscMalloc4()`, `PetscMalloc5()`, `PetscMalloc6()`, `PetscMalloc7()`, `PetscCalloc1()`, `PetscCalloc2()`, `PetscCalloc3()`, `PetscCalloc4()`, `PetscCalloc5()`, `PetscCalloc6()`, `PetscCalloc7()`, `PetscFreeA()`

## Level
developer

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/memory/mal.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
