Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
16
Task/Memory-allocation/PascalABC.NET/memory-allocation.pas
Normal file
16
Task/Memory-allocation/PascalABC.NET/memory-allocation.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
procedure ppp;
|
||||
begin
|
||||
var i,j: integer; // i,j are allocated automatically on the stack when we call procedure
|
||||
end;
|
||||
|
||||
begin
|
||||
ppp;
|
||||
var p: ^integer;
|
||||
New(p); // memory is allocated on the heap
|
||||
p^ := 666;
|
||||
Dispose(p); // explicit memory deallocation
|
||||
|
||||
var ri := new integer[5]; // memory is allocated on the heap
|
||||
ri[0] := 555;
|
||||
ri := nil; // memory is controlled by .NET garbage collector
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue