OK, recebi um e-mail de volta do meu instrutor, com uma resposta muito boa e razoável. Aqui está:
Hi Ramzi,
Thanks for the link to the interesting messages thread which you started.
As per our discussion, malloc operates on the process' virtual memory. So, when the process dies, its virtual address space "disappears", and any physical memory mapped to it is freed. Hence, disregarding "good software engineering practices" and such, dynamic memory de-allocation just before exiting a process is indeed a waste of time.
(Needless to say, this is not the case when a single thread terminates but other threads of that process keep executing.)
Então, de acordo com isso:
- É uma perda de tempo
- Não afetará mais tarde
- É independente das versões do sistema operacional.