H. S. Teoh:

(if your tree is 1 million nodes, then it
has to do 1 million free's, right then, right there,

In practice real C programs use arenas and pools to allocate the nodes from. This sometimes doubles the performance of C code that has to allocate many nodes of a tree data structure. A simple example:

http://rosettacode.org/wiki/Self-referential_sequence#Faster_Low-level_Version

Some of such code will become useless once Phobos has Andrei allocators :-)

In C sometimes you also use hierarchical memory allocation, to simplify the memory management (http://swapped.cc/?_escaped_fragment_=/halloc#!/halloc ), not currently supported by Andrei allocators.

Bye,
bearophile

Reply via email to