Skip to main content

drop_list

Function drop_list 

Source
pub fn drop_list<T>(list: List<T>)
Expand description

Iteratively drop a List<T> to avoid stack overflow on long lists.

The default recursive drop of Rc<Inner<T>> can overflow the stack when the list has thousands of nodes (e.g., A* parse results for large files). This function walks the list iteratively, unlinking each node before it is freed so that no stack frame chains are created.