Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FlexFile Reference Guide - <b>a_kill()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 A_KILL()
 Release memory for all or a range of elements from a string array
-------------------------------------------------------------------------------

 Syntax

    A_KILL( <aTarget>, [<idxPos>], [<nCount>] )

 Arguments

    <aTarget> is the array in which to release elements.

    <idxPos> is the position in the target array of the first element
    to be released.  If not specified, A_KILL() begins at the first
    element in the array.

    <nCount> is the number of elements to release. The default is all
    elements starting at <idxPos> until the end of the array. This
    includes wrapping.

 Returns

    None.

 Description

    FlexFile's string arrays are actually arrays of pointers. That is,
    the array consists of four byte elements, each element capable of
    pointing to a string of data. When declared, each element of the
    array is undefined.

    When data is A_STORE()d to an element of a string array, memory is
    allocated for that data. If the array of pointers falls out of
    scope before that memory is released, the memory is orphaned and
    essentially lost until the application is exited.

    Therefore, you must use A_KILL() to release the data before
    allowing a FlexFile string array to fall out of scope.

    +-------------------------- WARNING ---------------------------+ 
    | You must use A_KILL() to release the data from a String type | 
    | array before allowing the array to fall out of scope.        | 
    +--------------------------------------------------------------+ 

 Examples

    // Use A_KILL() to release a FlexFile string type array
    // before exiting the function that created it.

    Phrase( "Miles to go before I sleep" )


    FUNCTION Phrase( cSomePhrase )

       LOCAL ffArray
       // Declare a FlexFile string array.
       ffArray = A_DECLARE( 'S', 5, 8 )

       // Put the value into element A_( 3, 3 ).
       A_STORE( ffArray, cSomePhrase, A_( 3, 3 ) )

       // Do something with the array.
       ? A_RETRIEVE( ffArrary, A_(3, 3) )

       // It is necessary to release the memory
       // allocated for the string in the array.
       A_KILL( ffArray )

    // The array itself is released by Clipper on return
    RETURN (.T.)

See Also: A_STORE() A_DECLARE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson