Skip to main content
`Ctrl`+`K`

# PetscFreeA

Free one or more memory locations, possibly allocated using coalesced `PetscMallocN()`

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscFreeA(int n, int lineno, const char *function, const char *filename, void *ptr0, ...)

Not Collective, No Fortran Support

## Input Parameters

- n - number of objects to free (at least 1)

- lineno - line number to attribute deallocation (typically `__LINE__`)

- function - function to attribute deallocation (typically `PETSC_FUNCTION_NAME`)

- filename - file name to attribute deallocation (typically `__FILE__`)

- ptr0 - first of `n` pointers to free

## Notes

This function is not normally called directly by users, but rather via the macros `PetscFree()`, `PetscFree2()`, etc.

The pointers are zeroed to prevent users from accidentally reusing space that has been freed.

If the arguments were obtained via `PetscMallocA()`, `PetscMalloc2()`, `PetscMalloc3()`, etc., then the arguments must be passed in the same order to the corresponding `PetscFreeA()`, `PetscFree2()`, `PetscFree3()`, respectively.

## See Also

`PetscMallocAlign()`, `PetscMallocSet()`, `PetscMallocA()`, `PetscFree()`, `PetscFree2()`, `PetscFree3()`, `PetscFree4()`, `PetscFree5()`, `PetscFree6()`, `PetscFree7()`

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