Memory profiling
Sometimes, applications use too much memory. The worst-case scenario is that they use more and more memory as time goes by, normally due to what's called a memory leak, maintaining memory that is no longer used, due to some mistake in the coding. Other problems can also include the fact that the usage of memory may be improved, as it's a limited resource.
To profile memory and analyze what the objects are that use the memory, we need first to create some example code. We will generate enough Leonardo numbers.
Leonardo numbers are numbers that follow a sequence defined as the following:
- The first Leonardo number is one
- The second Leonardo number is also one
- Any other Leonardo number is the two previous Leonardo numbers plus one
Leonardo numbers are similar to Fibonacci numbers. They are actually related to them. We use them instead of Fibonacci to show more variety. Numbers are fun!
We present the first 35 Leonardo...