# Revision history [back]

The maximum depth of the trees is limited by the available memory, as can be seen from the following code snippet:

CvDTreeNode** CvGBTrees::GetLeaves( const CvDTree* dtree, int& len )
{
len = 0;
CvDTreeNode** leaves = new pCvDTreeNode[(size_t)1 << params.max_depth];
leaves_get(leaves, len, const_cast<pCvDTreeNode>(dtree->get_root()));
return leaves;
}


Therefore, maximum depth of tree should be kept small, according to Hastie et al., The elements of statistics, 2 (decision Stumps) will be sufficient in many applications and it is unlikely that the depth exceeds 10.