Relative Content

Tag Archive for memory-usage

Recursion VS memory allocation [duplicate]

This question already has answers here: What are the advantages of recursion compared to iteration? [duplicate] (5 answers) Are there advantages for using recursion over iteration – other than sometimes readability and elegance? [duplicate] (3 answers) Closed 9 years ago. Which approach is most popular in real-world examples: recursion or iteration? For example, simple tree […]

How to handle a memory consuming member variable

Suppose multiple objects of the same class should do something which takes a memory consuming resource. Which of the following approaches is recommended to define and use the resource by the objects?