OPTION GARBAGE

Previous  Next

 

OPTION GARBAGE ON/OFF

 


 

Turns on automatic garbage collection after each line of code has been executed.  This allows you to use NEW for temporary variables and arrays without having to explicitly UNREF a reference after use.

 

Example:

 

OPTION BASE 1

OPTION GARBAGE ON

 

DIM my_array(10,3) AS REAL

DIM nGraph AS INTEGER

 

' Initialize array

FOR i = 1 TO 10

  my_array(i,1) = i

  my_array(i,2) = 2

  my_array(i,3) = 3

NEXT i

 

nGraph = GRAPH.Create( "MyGraph" )

 

GRAPH.AddElement( nGraph, "My Array.X", V1D( NEW( REAL, 10 ), my_array, 1 ) )

GRAPH.AddElement( nGraph, "My Array.Y", V1D( NEW( REAL, 10 ), my_array, 2 ) )

GRAPH.AddElement( nGraph, "My Array.Z", V1D( NEW( REAL, 10 ), my_array, 3 ) )

 

.

.

.