Way to free memory in recursive functions?

marshal-mj

New Member
This recursive function uses over 1.4 MB of RAM, and it's not freed. All it returns is a single int. How can I free up much more memory?\[code\]function bottomUpTree($item, $depth){ if ($depth) { --$depth; $newItem = $item << 1; return array( bottomUpTree($newItem - 1, $depth), bottomUpTree($newItem, $depth), $item ); } unset($depth); unset($newItem); return array(NULL, NULL, $item);}bottomUpTree(0, 7);\[/code\]
 
Back
Top