Code segment unload: Difference between revisions

From Rosetta Code
Content added Content deleted
(initial draft)
 
Line 6: Line 6:


Languages that do not have the facility to free up their code segment (such as scripting languages) can be omitted.
Languages that do not have the facility to free up their code segment (such as scripting languages) can be omitted.

=={{header|BASIC}}==

Some versions of basic have the facility to delete lines of code:

<lang basic>10 GOSUB 5000: REM call initializer
20 DELETE 5000-9999: REM delete initializer
30 PRINT A: REM show initializer worked
40 LIST: REM show initializer has gone
50 END

5000 REM this is a dummy initializer
5010 LET A=1
5020 RETURN</lang>


{{omit from|Brlcad}}
{{omit from|Brlcad}}

Revision as of 10:35, 22 February 2013

Code segment unload is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Some advanced applications, such as memory resident applications, daemons and memory demanding applications unload unrequired parts of the application during use (such as initialization code that will no longer be used again once the application is operational) to free up memory and resources. Demonstrate or explain how to unload an unused section of code from memory.

Note that it is sufficient to flag the memory area as being available for reuse by the memory management system, without the need to demonstrate the zeroing of the bytes and performing a memory shuffle, unless such actions are required to free up the code segment.

Languages that do not have the facility to free up their code segment (such as scripting languages) can be omitted.

BASIC

Some versions of basic have the facility to delete lines of code:

<lang basic>10 GOSUB 5000: REM call initializer 20 DELETE 5000-9999: REM delete initializer 30 PRINT A: REM show initializer worked 40 LIST: REM show initializer has gone 50 END

5000 REM this is a dummy initializer 5010 LET A=1 5020 RETURN</lang>