# NAG CPP Interfacenagcpp::opt::handle_free (e04rz)

Settings help

CPP Name Style:

## 1Purpose

handle_free is a part of the NAG optimization modelling suite. It is used to deallocate the memory used within the problem handle and to destroy the handle itself.

## 2Specification

```#include "e04/nagcpp_e04rz.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
```
```template <typename COMM>

void function handle_free(COMM &comm, OptionalE04RZ opt)```
```template <typename COMM>

void function handle_free(COMM &comm)```

## 3Description

Each initialized problem handle (e.g., by handle_​init) should be deallocated to avoid memory leaks. Therefore, handle_free should be called on all the handles which are no longer needed, typically after obtaining results from the solver. Please note that passing a handle which has not been properly initialized might cause unpredictable behaviour, including a crash of your program. See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

None.

## 5Arguments

1: $\mathbf{comm}$CommE04RA Input/Output
Communication structure. An object of either the derived class CommE04RA or its base class NoneCopyableComm can be supplied. It is recommended that the derived class is used. If the base class is supplied it must first be initialized via a call to opt::handle_init (e04ra).
2: $\mathbf{opt}$OptionalE04RZ Input/Output
Optional parameter container, derived from Optional.

## 6Exceptions and Warnings

Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
$\mathbf{errorid}=1$
comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
$\mathbf{errorid}=1$
comm::handle has not been initialized properly or is corrupted.
$\mathbf{errorid}=10605$
On entry, the communication class $⟨\mathit{\text{value}}⟩$ has not been initialized correctly.
$\mathbf{errorid}=-99$
An unexpected error has been triggered by this routine.
$\mathbf{errorid}=-399$
Your licence key may have expired or may not have been installed correctly.
$\mathbf{errorid}=-999$
Dynamic memory allocation failed.

Not applicable.

## 8Parallelism and Performance

Please see the description for the underlying computational routine in this section of the FL Interface documentation.