I have a program that does the following
- Allocate memory (heap)
- Do some processing
- Allocate more memory (heap)
- Do some processing
It does so a few times then exit.
I don't really care about the memory footprint of the program, only the execution time.
Would it be a bad thing not to free memory on the account that it might actually takes more time to process the free/delete than just skip it and move to next step.
In the end, the program will exit and it won't matter anymore.
I understand that the only way to be sure is to do some benchmarks on my computer, but I'm interested in the theoretical pros and cons.
NB: let's assume a modern OS that will cleanup the memory at exit.