informix
Informix Guide to SQL: Syntax
SQL Statements

DEALLOCATE COLLECTION

Use the DEALLOCATE COLLECTION statement to release memory for a collection variable that was previously allocated with the ALLOCATE COLLECTION statement.

Use this statement with ESQL/C.

Syntax

Element Purpose Restrictions Syntax
variable Name that identifies a typed or untyped collection variable for which to deallocate memory The variable must be the name of an ESQL/C collection variable that has already been allocated. Name must conform to language-specific rules for variable names.

Usage

The DEALLOCATE COLLECTION statement frees all the memory that is associated with the ESQL/C collection variable that variable identifies. You must explicitly release memory resources for a collection variable with DEALLOCATE COLLECTION. Otherwise, deallocation occurs automatically at the end of the program.

The DEALLOCATE COLLECTION statement releases resources for both typed and untyped collection variables.

Tip: The DEALLOCATE COLLECTION statement deallocates memory for an ESQL/C collection variable only. To deallocate memory for an ESQL/C row variable, use the DEALLOCATE ROW statement.

If you deallocate a nonexistent collection variable or a variable that is not an ESQL/C collection variable, an error results. Once you deallocate a collection variable, you can use the ALLOCATE COLLECTION to reallocate resources and you can then reuse a collection variable.

Example

The following example shows how to deallocate resources with the DEALLOCATE COLLECTION statement for the untyped collection variable, a_set:

Related Information

Related example: refer to the collection variable example in PUT.

Related statements: ALLOCATE COLLECTION and DEALLOCATE ROW

For a discussion of collection data types, see the Informix ESQL/C Programmer's Manual.


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved