Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə241/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   237   238   239   240   241   242   243   244   ...   294
DelphiLanguageGuide

Variables
Global variables are allocated on the application data segment and persist for the duration of the program. Local
variables (declared within procedures and functions) reside in an application's stack. Each time a procedure or
function is called, it allocates a set of local variables; on exit, the local variables are disposed of. Compiler optimization
may eliminate variables earlier.
On Win32, an application's stack is defined by two values: the minimum stack size and the maximum stack size.
The values are controlled through the 
$MINSTACKSIZE
 and 
$MAXSTACKSIZE
 compiler directives, and default to
16,384 (16K) and 1,048,576 (1Mb) respectively. An application is guaranteed to have the minimum stack size
available, and an application's stack is never allowed to grow larger than the maximum stack size. If there is not
enough memory available to satisfy an application's minimum stack requirement, Windows will report an error upon
attempting to start the application.
If a Win32 application requires more stack space than specified by the minimum stack size, additional memory is
automatically allocated in 4K increments. If allocation of additional stack space fails, either because more memory
is not available or because the total size of the stack would exceed the maximum stack size, an EStackOverflow
exception is raised. (Stack overflow checking is completely automatic. The 
$S
 compiler directive, which originally
controlled overflow checking, is maintained for backward compatibility.)
Dynamic variables created with the 
GetMem
 or 
New
 procedure are heap-allocated and persist until they are
deallocated with 
FreeMem
 or 
Dispose
.
205


Long strings, wide strings, dynamic arrays, variants, and interfaces are heap-allocated, but their memory is managed
automatically.
206



Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   237   238   239   240   241   242   243   244   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin