db4o |

# Configuration.ActivationDepth Method

sets the activation depth to the specified value.

void ActivationDepth(
int depth
);

#### Parameters

depth
  the desired global activation depth.

#### Remarks

sets the activation depth to the specified value.
Why activation?
When objects are instantiated from the database, the instantiation of member objects needs to be limited to a certain depth. Otherwise a single object could lead to loading the complete database into memory, if all objects where reachable from a single root object.
db4o uses the concept "depth", the number of field-to-field hops an object is away from another object. The preconfigured "activation depth" db4o uses in the default setting is 5.
Whenever an application iterates through the ObjectSet of a query result, the result objects will be activated to the configured activation depth.
A concrete example with the preconfigured activation depth of 5:

     // Object foo is the result of a query, it is delivered by the ObjectSet Object foo = objectSet.next();

foo.member1.member2.member3.member4.member5 will be a valid object
foo, member1, member2, member3 and member4 will be activated
member5 will be deactivated, all of it's members will be null
member5 can be activated at any time by calling ObjectContainer#activate(member5, depth) .
Note that raising the global activation depth will consume more memory and have negative effects on the performance of first-time retrievals. Lowering the global activation depth needs more individual activation work but can increase performance of queries.
ObjectContainer#deactivate(Object, depth) can be used to manually free memory by deactivating objects.

#### See Also

Configuration Interface | com.db4o.config Namespace | configuring classes individually