Routines (alphabetical) > Object Classes > File Format Object Classes > IDLffShape::DestroyEntity

# IDLffShape::DestroyEntity

The IDLffShape::DestroyEntity procedure method frees memory associated with the entity structure. For more information on the entity structure, see Entities.

Note: If Automatic Garbage Collection is enabled, using this method to free memory is not necessary. You may choose to destroy your entity references manually if you need to free system resources before the shapefile object is destroyed.

## Syntax

Obj->[IDLffShape::]DestroyEntity, Entity

## Arguments

### Entity

A scalar or array of entities to be destroyed.

## Keywords

None

## Examples

In the following example, all of the entities from the `states.shp` Shapefile are read and then the DestroyEntity method is called to clean up all pointers:

PRO ex_shapefile

; Open the states Shapefile in the examples directory.

myshape=OBJ_NEW('IDLffShape', FILEPATH('states.shp', $

SUBDIR=['examples', 'data']))

; Get the number of entities so we can parse through them.

myshape->GetProperty, N_ENTITIES=num_ent

; Read all the entities.

FOR x=1, (num_ent-1) DO BEGIN

;Read the entity x

ent = myshape->GetEntity(x)

;Clean-up of pointers

myshape->DestroyEntity, ent

ENDFOR

; Close the Shapefile.

OBJ_DESTROY, myshape

END

## Version History

5.4 | Introduced