Mike Copeland mentioned this to Gary Weinfurther:
MC> I'm still (more) confused. If Windows releases allocated memory
MC> when a program terminates, and if a Heap area isn't being reused within
MC> the program's execution, why _should_ you burden the program code with
MC> (seemingly extraneous) Dispose/FreeMem calls which do nothing functional
MC> for the program?
Two reasons:
1. It's good coding practice. "What ye create, ye shall also destroy."
2. While your application is running, all those allocations will accumulate
and eventually use up all the system resources. The entire Windows
environment (at least in Windows 3.1) allows only 8192 global memory
allocations. That's system-wide. By not releasing your allocations as
needed, you are robbing other applications of the ability to allocate memory.
MC> Believe me, I know the value/use of Dispose/FreeMem on TP/BP (I
MC> moderate the Pascal_Lessons echo), but are you saying that Delphi has
MC> different rules than them for their use?
No, it does not. You should follow the same rules. Your current and future
employers and/or customers will thank you.
...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS. (1:2410/905)
|