PEAR Manual
Prev |  | Next

# ->free()

->free() -- Free resources

## Synopsis

``object $DB_DataObject->free` ()`

## Description

DataObjects stores result set's as a private global variable, normally this is free'ed after you have run through the results, or at the end of the request. However in some situations, like running queries directly, inserting data, some data is unnecessarly cached.

Using this method will Free All results sets! (so be carefull) it may break running fetch() loops..

You normally only need to use this if you are doing a large number of inserts or queries.

## Note

This function can not be called statically.

## Example

Example 33-1. Freeing resources in a loop
    <?php

    for ($i = 0; i< 10000; $i++) {
        $person = new DataObjects_Person;
        $person->query(' ... do something ... ');
        $person->free();
    }

    ?>

Prev | Home | Next
->query() | Up | ->selectAdd()