Sign in Join
Wiki copytemporary

Dispose: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Dispose

OldNewLine
1+Back to [[Reserved words]].
2+
3+The reserved word **dispose** belongs to object-oriented programming.
4+
5+The reserved word **dispose** releases the memory by reducing the reference counter to the memory object by 1. If the reference counter of an object is 0, the memory object is released.
6+
7+Example:
8+
9+``` pascal
10+ var
11+ intI: ^ Integer;
12+
13+ begin
14+ ...
15+ if assigned (intI) then ... // Checks whether an address has been assigned to intI
16+ ...
17+ new (intI); // Assigns a valid address to intI
18+ ...
19+ dispose (intI); // Releases the address
20+ ...
21+```
22+
23+---
24+*From the Free Pascal wiki, page "Dispose", as it stood on 2020-02-13 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history