13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MARK and RELEASE are used in pairs. Each pair requires a previouslydeclared pointer variable. Here is the syntax:pointervariableidentifierVAR FLAG1, FLAG2 : AINTEGER;By using more than one pointer variable, you can place more than one pairof MARK and RELEASE procedures in your program.Consider this example:REPEATMARK ff LAG 1 >; {Mark start of repeated part}... program part A ...MARK ffLAG2); {Mark start of part 8}... program part B ...RELEASE CFLAG2 >; {Release memory used by part B>... program part C ...RELEASE ff LAG 1);UNTIL ... some condition ...{Release all memory}{Repeat}In this example, we have written a repeating program section in whichdynamic variables are created by NEW procedures. In the areas indicatedas parts B and C, the new dynamic variables are so large that they wouldtake up more than the available memory if they all coexisted. So thememory used by part B is released for use by part C. This means that thevariables created in part B can no longer be accessed. The variables createdin part A, however, continue to exist until the memory used by the entirerepeated section is released.Keep the following points in mind when using MARK and RELEASE:o RELEASE must not be executed unless a MARK has previously beenexecuted with the same pointer variable.Memory Management for Dynamic VariablesIII-69

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!