Excessive Dynamic Allocation

Dynamic allocation is expensive. When an object is created, the memory to contain it (and any objects that it contains) must be allocated from the heap and any initialization code for the object and the contained objects must be executed. When the object is no longer needed, necessary clean-up must be performed and the reclaimed memory must be returned to the heap to avoid “memory leaks.” While the overhead for creating and destroying a single object may be small, when a large number of objects are frequently created and then destroyed, the performance impact may be significant.

Reference

C. U. Smith, L. G. Williams. “Software performance antipatterns”. WOSP 2000, pp. 127-136.


Performance Smells

Home

All rights reserved (c) Tushar Sharma 2017-23.