Skip to main content
`Ctrl`+`K`

# PetscMallocSetCoalesce

Use coalesced `PetscMalloc()` when allocating groups of objects, that is when using `PetscMallocN()`

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscMallocSetCoalesce(PetscBool coalesce)

Not Collective

## Input Parameter

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

## Options Database Key

- -malloc_coalesce - turn coalesced `PetscMallocN()` on or off

## Notes

PETSc uses coalesced `PetscMallocN()` 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()`, `PetscMalloc()`, `PetscFree()`

## Level

developer

## Location

src/sys/memory/mal.c

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