# PetscMallocSetCoalesce
Use coalesced malloc when allocating groups of objects 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscMallocSetCoalesce(PetscBool coalesce)
```
Not Collective


## Input Parameters

- ***coalesce -*** `PETSC_TRUE` to use coalesced malloc for multi-object allocation.



## Options Database Keys

- ***-malloc_coalesce -*** turn coalesced malloc on or off



## Notes
PETSc uses coalesced malloc by default for optimized builds and not for debugging builds.

This default can be changed via the command-line option -malloc_coalesce or by calling this function.

This function can only be called immediately after `PetscInitialize()`




## See Also
 `PetscMallocA()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/memory/mal.c.html#PetscMallocSetCoalesce">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)  
