TIP: Click on subject to list as thread! ANSI
echo: delphi
to: GARY WEINFURTHER
from: MIKE COPELAND
date: 1996-12-31 08:11:00
subject: Dynamic Memory Allocation

 BS> Maybe somebody can clear up my confusion.  I somehow got the impression
 BS> that in Delphi/Windows, unlike TP/DOS, any memory allocated dynamically
 BS> with GetMem() or New() is not automatically returned to the system when
 BS> the program exits.  In other words, in Delphi, you have to free it
 BS> yourself with FreeMem/Dispose.
 GW> Windows will automatically free allocated memory when a program exits
 GW> properly. That doesn't mean that you should not do your own release of
 GW> memory. 
   I'm still (more) confused.  If Windows releases allocated memory
when a program terminates, and if a Heap area isn't being reused within
the program's execution, why _should_ you burden the program code with
(seemingly extraneous) Dispose/FreeMem calls which do nothing functional
for the program?
   Believe me, I know the value/use of Dispose/FreeMem on TP/BP (I
moderate the Pascal_Lessons echo), but are you saying that Delphi has
different rules than them for their use?
... Beer nuts:  The dreaded final stage of cotton balls.
--- OMX/Blue Wave/DOS v2.20
---------------
* Origin: Mike's Place (1:114/307.0)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.